Hi whats the difference between the database connection made from a stand alone code and that made from a web application deployed in sun java web server.
The code used to connect to the database, when run as separately the db connection is successful. But the same code inside my web application when deployed is not able to make the database connection. The DB is accessed remotely through VPN.
public OracleConnectionPoolWrapper(DBInfo dataSource) throws SQLException { OracleConnectionCacheImpl ora; OracleConnectionPoolDataSource oracleConnectionPoolDataSource = new OracleConnectionPoolDataSource(); oracleConnectionPoolDataSource.setURL(dataSource.getConnectionString()); oracleConnectionPoolDataSource.setUser(dataSource.getUserName()); oracleConnectionPoolDataSource.setPassword(dataSource.getPassword()); ora = new OracleConnectionCacheImpl(oracleConnectionPoolDataSource); ora.setMaxLimit(dataSource.getPoolSize()); ora.setCacheScheme(1); Connection con = ora.getConnection(); }
Given above is the piece of code within my application which is used to connect to a database accessed through a VPN. When this piece of code is run as stand alone program when the VPN connection is established, it successfully connects to the database. But a web application having the same code when deployed in Sun java web server and the VPN connection established is not able to connect to the database.i'm getting the following error
Io exception: The Network Adapter could not establish the connection [15/Feb/2010:16:31:31] warning ( 4308): CORE3283: stderr: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection [15/Feb/2010:16:31:31] warning ( 4308): CORE3283: stderr: at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)