|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
ConnectionRead Exception
Hi all,
I have an application in java run at tomcat server, sometimes when it connects to sql 2000 database using jdbc-odbc the following exception is thrown java.sql.sqlException [microsoft][ODBC sql server][DBNETLIB] ConnectionRead (recv()) what does this mean? thanks |
|
#2
|
|||
|
|||
|
Can you post a snippet of the exceptions that are being caught?
|
|
#3
|
|||
|
|||
|
Sure, but actually the caught exception is exactly the line I've sent
the scenario in which this exception is thrown is: 1- In my class I define a static section for the connection like this static { try{ con = DriverManager.getConnection("jdbc: odbc: sqlDSN","username","pass"); st = con.prepareStatement("Select * from [tbl1]"); } catch(Exception ex) { System.err.println(ex); } } 2- Then a function is called every 3 sec to execute the line rs = st.executeQuery(); on the previously defined st (which is defined once) and process the result that is all every thing goes well for sometime then that exception is thrown!!! thanks |
|
#4
|
|||
|
|||
|
Can you try catching the SQLException error? It seems as if you are unable to connect to the MS SQL Server.
|
|
#5
|
|||
|
|||
|
The line rs = st.executeQuery(); is in try..catch block
I agree with u, it seems as if it is unable to connect to the MS SQL Server But I wonder, this exception appears after many times of sucsses connections by the same line, as I said the function that contains this line (rs = st.executeQuery()) is called once every 3 sec Why it sometimes works fine and other times give this exception? My only weak interpretation is that the connection (which is defined once in the static block) loses its validity after sometimes for some reason....is it logic? |
|
#6
|
|||
|
|||
|
Are you reusing the connection over and over again or are you instantiating the connection again and again?
|
|
#7
|
|||
|
|||
|
I'm reusing the connection again and again not instantiating the connection again and again
|
|
#8
|
|||
|
|||
|
Is there a long delay at times that could be causing a driver or database timeout?
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > ConnectionRead Exception |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|