JNDI and Servlets
Posted in 2000
Topics: Connectivity: ODBC / JDBC / .NET, Java & JDBC Development
Hello I'm writing a servlet that retrieves data from an Informix DS 2000 9.20 database. I'm using the Informix JDBC Driver v. 2.11.JC1. I would like to use the JNDI interface for making connections to that database, so I registered a pooled data source named jdbc/Gsc2. The following code: Context initCtx = new InitialContext(); DataSource myDs = (DataSource)initCtx.lookup("jdbc/Gsc2"); con = myDs.getConnection(); behaves well in a Java Application, but when I insert it in a Java Servlet, I receive a 500 Internal Server Error from the Web Server (Apache 1.3.9 with JServ 1.0). Examining the JServ log I found it produces a javax.naming.NameNotFoundException: Gsc2 Any idea about the reason of this different behaviour? Thanks in advance. Lucio -- ( Lucio Benfante http://www.dei.unipd.it/~benfante ) Sent via Deja.com http://www.deja.com/ Before you buy.