Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Io exception: Connection refused
cliao wrote:
> Has any one seen similar exceptions to the following one? Why do I get
> the exception?
>
> Thanks,
>
> Christian
>
> java.sql.SQLException: Io exception: Connection
> refused(DESCRIPTION=(TMP=)(VSNNUM=153093120)(ERR=12519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
> at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
> at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
For security reasons, DBMSes are typically taciturn about why they refuse a connection. You shouldn't expect anything like "Your user name is OK, but your password is one char too long" etc.
Presuming you're sure of your username and password (this exact same code may have worked before in the same JVM), the issue is possibly that the DBMS is getting too many concurrent connection requests, and can sometimes fail some of these identical attempts. If you can serialize your JVM's attempts to make JDBC connections, and maybe even put a .2 sec delay between successive connection attempts, the problem may go away. You can also avoid this if your application or framework were to pool connections. I am sad to see Oracle's datasource calling DriverManager under the covers. All DriverManager methods are overly (class) synchronized, and can cause concurrency degradation im multithreaded applications. Joe Weinstein at BEA
> at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:141)
> at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:169)
> at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:108)
> at com.bristol.tvision.datamgr.OracleDataSourceConnectionSource.getConnection(OracleDataSourceConnectionSource.java:69)
> at com.bristol.tvision.datamgr.DataManager.connect(DataManager.java:1053)
> at com.bristol.tvision.datamgr.DataManager.getThreadConnection(DataManager.java:368)
> at com.bristol.tvision.services.collection.EventQueueThread.run(EventQueueThread.java:97)
Received on Thu Feb 19 2004 - 15:34:00 CST