Hi,
I've been having a hard time making a JNDI data source work. Following instructions at http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html I'm connecting to oracle with Tomcat5.5 I can connect fine if I use straight JDBC connection in code.
Here is what I have: in my META-INF/context.xml:
<Resource name="jdbc/mydb" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:theserver:1521/mydb"
username="user" password="password" maxActive="20" maxIdle="10"
/>
here is what is in web.xml:
<resource-ref>
<description>please work</description>
<res-ref-name>jdbc/mydb</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>Container</res-auth>
</resource-ref>
here is code: Connection conn = null; try{ InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/mydb"); conn = ds.getConnection(); } catch ....... etc.
I've tried many different configurations and started a new, simple project to ensure that no extra jar files conflicted or anything like that, but .
can anyone see anything that doesn't look right?
the error on the server indicates a NullPointerException when I attempt to use the conn object. excuse me, it first offers: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io exception: The Network Adapter could not establish the connection)