alexbrainman / odbc

odbc driver written in go
BSD 3-Clause "New" or "Revised" License
359 stars 141 forks source link

Query fails if server restarts after initial DB open. #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Connecting to MS SQL Server via ODBC on MS Window.

If SQL Server is restarted while a long running program is running with a 
maintained reference to *database/sql.DB, then any queries after restart will 
fail. The error I receive is:

SQLDescribeParam: {01000} [Microsoft][ODBC SQL Server Driver][DBMSLPCN
]ConnectionWrite (WrapperWrite()). {08S01} [Microsoft][ODBC SQL Server 
Driver][DBMSLPCN]General network error. Check your network documentation.

It would seem sub-optimal to require checking this error after every 
connection. Rather, the intended behavior should be to attempt to re-connect, 
then if that fails, provide a special error type to check against (Connection 
not available).

Original issue reported on code.google.com by kardia...@gmail.com on 11 Jun 2013 at 4:43

GoogleCodeExporter commented 9 years ago
After reading the Go ODBC code and doing a few searches, I'm not entirely 
convinced this is the driver's fault. I'm not entirely sure if this applies:
http://support.microsoft.com/kb/942861

For now I'll get around this by making the service depend on the SQL Server 
service.

Original comment by kardia...@gmail.com on 11 Jun 2013 at 5:30

GoogleCodeExporter commented 9 years ago
I think you just need to reconnect. I don't see how this can be automated in 
the driver. But I am opened to suggestions. Sorry.

Alex

Original comment by alex.bra...@gmail.com on 12 Jun 2013 at 12:13