Friday, 15 June 2012

java - trouble with JNDI Data Source in Tomcat -


I have a hard time working with a JNDI data source. When connecting with Oracle with Tomcat5.5, I add the following instructions: I can connect properly in the code using a direct JDBC connection.

What do I have here: in my meta-INF / context.xml:

  & lt; Resource Name = "jdbc / mydb" auth = "container" type = "javax.sql.DataSource" driverClassName = "oracle.jdbc.OracleDriver" url = "jdbc: oracle: thin: Thaiserver: 1521 / MEDI" username " User "password =" password "maxactive =" 20 "maxidell =" 10 "/>  

Here's what's in web.xml:

  & lt; Resource-Rif & gt; & Lt; Details & gt; Please work & lt; / Description & gt; & Lt; Race-referee-name & gt; JDBC / mydb & lt; / Race-referee-name & gt; & Lt; Race Type & gt; Javax.sql.DataSource & lt; / Res-type & gt; & Lt; Race writing & gt; Container & lt; / Writing the race & gt; & Lt; / Resources Ref & gt;  

Here is the code:

  connection conn = null; Try {InitialContext ic = new InitialContext (); Datasource DS = (Datasource) IC .lookup ("java: comp / env / jdbc / mydb"); Conn = ds.getConnection (); } Hold ....... etc.  

I have tried many different configurations and have started a new, simple project to ensure that no additional jar Files disputed or nothing like that, but

Can anyone see something that does not look right?

error on the server when I try to use cone object then a NullPointerException indicates. I'm sorry, it provides first: org.apache.tomcat.dbcp.dbcp.SQLNestedException: PoolableConnectionFactory (Io Exception: Could not establish network adapter connection)

< Try div class =

  jdbc: oracle: thin: "post-text" itemprop = "text"> 

@Chaserver: 1521 / MyDB


No comments:

Post a Comment