sql java errors

when error log says both sql and java in the same line, how can we troubleshoot where the problem is.. this happens once in a few days...
Who is Participating?
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Can you show how you are configuring your DataSource? From the error I gather you are using c3p0 for pooling data sources. The error that you are getting is probably from SQL Server closing connections after a certain period of idle time. You should be able to configure c3p0 to test connections periodically so that the server doesn't time them out, or other similar configurations to overcome this type of problem.

Post your config and we should be able to assist.
25112Author Commented:
here is an example:
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error
               at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)
               at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1355)
               at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:1548)
               at com.microsoft.sqlserver.jdbc.TDSWriter.flush(IOBuffer.java:2368)
               at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:2270)
               at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:1877)
               at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:4403)
               at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:386)
               at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)
               at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
               at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
               at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)
               at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)
               at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:281)
               at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
               at java.lang.Thread.run(Thread.java:662)
Amitkumar PSr. ConsultantCommented:
This seems to be a network issue at first look. This occurs even network is down for a second.

However, there are many reasons... like..
1. network issue
2. connection timeout
3. application lost a connection
so on.
Naveen KumarProduction Manager / Application Support ManagerCommented:
May be you can get to the bottom of the problem by running your app/code in the debugging/log mode to let you know at what point it throws the below error and then go from there to see what can be done to fix it.

25112Author Commented:
your clues have helped me. thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.