c# - Time outs using ODBC but not Openquery to a linked server -
i connecting external database via linked server. using multithreaded console program in c#
break select
statement.
select * ( select c.part_key, c.part_operation_key, c.net_weight, c.plexus_customer_no, c.serial_no, row_number() on (order c.serial_no) row part_v_container c ) a.row > 0 , a.row <= 1000000
it works charm , when ten threads grab 100000 records each cuts time 8 minutes minute. during testing made 1 thread whole 1000000 records. basic code follows:
try { adapter = new odbcdataadapter(sqlstatement, connection); datatable datatable = new datatable(); adapter.fill(datatable); timespan span = (timerstart - datetime.now); console.writeline("data collected thread " + threadnumber + " in time of " + span); timetest(span); console.writeline("rows collected = " + datatable.rows.count); retries = 0; datacollected = true; }
again works it's not problem. problem keep getting timeout error plex when try whole 1000000 records:
there problem pulling data database thread number 0 error msg follows: system.data.odbc.odbcexception (0x80131937): error [hyt00] [plex][odbc odbc report data source driver][openaccess sdk sql engine]query timeout expired[10246] @ system.data.odbc.odbcconnection.handleerror(odbchandle hrhandle, retcode retcode) @ system.data.odbc.odbccommand.executereaderobject(commandbehavior behavior, string method, boolean needreader, object[] methodarguments, sql_api odbcapimethod) @ system.data.odbc.odbccommand.executereaderobject(commandbehavior behavior, string method, boolean needreader) @ system.data.odbc.odbccommand.executereader(commandbehavior behavior)
@ system.data.odbc.odbccommand.executedbdatareader(commandbehavior behavior) @ system.data.common.dbcommand.system.data.idbcommand.executereader(commandbehavior behavior) @ system.data.common.dbdataadapter.fillinternal(dataset dataset, datatable[] datatables, int32 startrecord, int32 maxrecords, string srctable, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable[] datatables, int32 startrecord, int32 maxrecords, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable datatable) @ shippedcontainersettlement.datacollectionthread.datacollectionthread() in c:\users\dkb\source\workspaces\workspace\danrex\shippedcontainersettlement\shippedcontainersettlement\datacollectionthread.cs:line 39 , sqlquery was: select * (select c.part_key, c.part_operation_key, c.net_weight, c.plexus_customer_no, c.serial_no, row_number() on (order c.serial_no) row part_v_container c) a.row > 0 , a.row <=1005066
if run same query in sql management studio using openquery though can collect entire 1000000 records.
i have no clue why because i'm not knowledgeable on databases hoping can explain why might case?
edit: may answer found on forum.
openquery performed on server , it's processing rows faster , returning 1 row on network. doing in visual studio may getting complete resultset , filtering on receiving (client) server. might why times out visual studio not ssms.
seem reasonable?
i tested openquery in c# , timeout tables 3000 records. not sure happening.
Comments
Post a Comment