I figured it out. I had followed Tomcat documentation while doing this.
The Oracle example in the documentation mentioned url as
jdbc:oracle:thin:[EMAIL PROTECTED]:1521:mysid
Following that I specified my url as 
jdbc:oracle:thin:[EMAIL PROTECTED]:1521:rep while actually it should be
jdbc:oracle:thin:[EMAIL PROTECTED]:1521/rep

With that change, it worked!

Ashvini 

On Thu, 22 Jun 2006 23:40:42 +0530, "Ashvini K Saxena"
<[EMAIL PROTECTED]> said:
> I am trying to use a datasource to access an Oracle database (Tomcat
> 5.5.9 and Oracle 9i). I have configured a datasource in the context.xml
> as follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Context
>     reloadable="true">
>   <Resource
>     name="jdbc/reportdb"
>     type="javax.sql.DataSource"
>     url="jdbc:oracle:thin:[EMAIL PROTECTED]:1521:rep"
>     driverClassName="oracle.jdbc.OracleDriver"
>     password="rep123"
>     maxActive="4"
>     maxWait="5000"
>     maxIdle="2"
>     username="rep"/>
>   <WatchedResource>WEB-INF/web.xml</WatchedResource>
> </Context>
> 
> In web.xml I am referring to the datasource as:
> 
> <resource-ref>
>       <description>The Reports DataSource</description>
>       <res-ref-name>jdbc/reportdb</res-ref-name>
>       <res-type> javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>       <res-sharing-scope>Unshareable</res-sharing-scope>
> </resource-ref>
> 
> The code for creating connections is something like this:
> try {
>       Context ctx = (Context)(new InitialContext().lookup("java:comp/env"));
>       DataSource ds = (DataSource)ctx.lookup("jdbc/reportdb");
>       Connection con = ds.getConnection();
> } catch (NamingException e) {
>       e.printStackTrace();
> } catch (SQLException e) {
>       e.printStackTrace();
> }
> 
> The Oracle JDBC driver, classes12.jar is in common/lib.
> 
> At runtime I get the following error:
> java.lang.NullPointerException
>       
> org.apache.tomcat.dbcp.dbcp.DelegatingConnection.close(DelegatingConnection.java:151)
>       
> org.apache.tomcat.dbcp.dbcp.PoolableConnection.reallyClose(PoolableConnection.java:95)
>       
> org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:301)
>       
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:883)
>       
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
>       
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
>       gaim.ui.report.action.ShowReport.doPost(ShowReport.java:42)
> 
> Has anyone encountered a similar problem and know of a solution? Is
> there anything I am missing in my configuration?
> 
> Thanks and Regards,
> 
> Ashvini K Saxena
> -- 
>   Ashvini K Saxena
>   [EMAIL PROTECTED]
> 
> -- 
> http://www.fastmail.fm - IMAP accessible web-mail
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-- 
  Ashvini K Saxena
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - The professional email service


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to