JDBC timeout from one server but not the other

  • Hello experts,

    We have a production application server PROD and a development application server DEV. For testing purposes, developers are trying connections to the production SQL Server from PROD and DEV. Let's call the SQL Server SQLPROD.

    We have run into a strange issue. Specifically:

    JDBC connection DEV to SQLPROD works

    JDBC connection PROD to SQLPROD times out with the same JDBC connection.

    Connection verification failed for data source: my_connection
    java.sql.SQLException: Timed out trying to establish connection
    The root cause was that: java.sql.SQLException: Timed out trying to establish connection

    telnet works on both client hosts.

    the client host IP addresses are correctly in the SQLPROD firewall settings.

    I even see both PROD and DEV IP connections in the SQLPROD sessions with this query:

    SELECT session_id, connect_time, net_transport, encrypt_option, auth_scheme, client_net_address 
    FROM sys.dm_exec_connections

    I know there are probably several possible reasons for the timeout on one connection but not the other. But I don't know enough about networking to figure out how to separate possible network issues from possible client/SQL config issues. Could someone help me determine next troubleshooting steps?

    Thanks for any help!

    -- webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

  • Possibly a dumb question, but are both DEV and PROD using the same account to run the tool that connects to SQLPROD?  I mean an AD account, not a "local to the machine" account as local accounts, even with the same name, would have a different SID and thus be different accounts.

    I doubt that would throw a "timeout" error, but could be a bug in that particular JDBC driver that it reports back "time out" when login failed.  is it the same JDBC driver version on both DEV and PROD?  not just the major version (like 10.3), but the full version (10.3.0.2564 BUILD 30346)?  I made up those version numbers off the top of my head; don't rely on those or try to find those versions, just make sure both DEV and PROD have the same JDBC driver installed.

    Might not hurt to run a tracert to the machine that hosts SQLPROD to make sure the path is similar between the two machines (dev and prod) to the one that hosts SQLPROD.  Could be the network path is substantially longer on PROD and is timing out due to the path length.

    Another thing to check would be the SQL Server logs and the logs on the servers (PROD and the one that hosts SQLPROD) to make sure there is nothing odd there.

    IF you can't find anything from the above, I would put some additional debug output into your application code.  You know the problem starts when you are connecting to SQL using the JDBC driver, so dump to a log file the current datetime and the first command in the function that is failing including any arguments/parameters/relevant variables and repeat for each line in that function.  Then run the tool, wait for it to fail, and check the log and you will have a lot more to go on.  If you have access to a debugger, I would use that rather than dumping output to a file as you can debug the code much easier.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply