Oracle connection problem with multple datasources
843841Oct 4 2004 — edited Oct 15 2004Seeing strange oracle connection problems, when using multiple data sources and
on of the datasource initialized during app server startup ( in serverlet init method )
I have servlet with load-on-start flag ON and oracle connection of one the data sources being done in servlet init method. This succeeds.
public void init() throws ServletException {
super.init();
..
..
conn1 = datasource1.getConnection() // works
..
..
conn1.close();
}
But when trying to get connection for a second datasource in doGet() or any where else, it fails with ORA-12154 (TNS:could not resolve service name) error). However getConnection to first data source succeeds.
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
conn2 = datasource2.getConnection() // fails with ORA-12154
..
..
conn2.close();
..
..
conn1 = datasource1.getConnection() // works
..
..
conn1.close();
}
Also to be noted is that all works fine if load-on startup flag for the servlet is turned OFF.
Appreciate any help in this regards, am using Websphere 5.1 app server