Oracle JDBC DriverManager.getConnection() hangs

后端 未结 3 1498
误落风尘
误落风尘 2021-01-23 14:39

We have several servers that each run an Oracle database 11g Release 11.2.0.1.0 - 64bit. We are connecting via JDBC like this:

public Connection createConnection         


        
相关标签:
3条回答
  • 2021-01-23 15:30

    You might want to enable JDBC debug logging for the ojdbc driver: http://docs.oracle.com/cd/B28359_01/java.111/b31224/diagnose.htm That might give you some information about what the driver is doing.

    Have you tried telnet-ing to the database server from the client machine (to assert it's reachable)?

    0 讨论(0)
  • 2021-01-23 15:33

    you may making some unneccessary connections.

    make Connection class static ,whenever you are creating new connection check older is alive or close then and then you must create new connection other wise return old connection.

    like

     if(conn!=null & !conn.isClosed()){ 
    // code for create connection
    }
    

    It also depends on how the database side is configured, so check it with DBA of your system.

    I would like to suggest using Connection pooling.

    hope this helps.

    0 讨论(0)
  • 2021-01-23 15:35

    The server was misconfigured. For some reason it had a virtual adapter configured which returned an ip to which nothing could connect. From outside the resolving worked correctly. Don't know why it never timed out with the wrong IP though.

    0 讨论(0)
提交回复
热议问题