Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 8th, 2003, 07:59 PM
codechimp codechimp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 15 codechimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem with Tomcat and Oracle 9i

Hello,

I am running Tomcat and Oracle 9i. I am trying to get my connection pooling working so I can use a JNDI. But I am having a problem.

When I include everything in a jsp file it connects to the database and produces a result.

Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection(
"jdbcracle:thin:@xxx.xxx.xx.xx:1521:dev",
"happy",
"xxxx");

When I have it in the Context I just get:
A Java.nullpointerexception

My server.xml is:
<parameter>
<name>url</name>
<value>jdbcracle:thin:@xxx.xxx.xxx.xxx:1521:dev</value>
</parameter>
With the same parameters for username and password as above.

My servlet is:
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Oops - No Context");

DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/database");

if (ds != null)
conn = ds.getConnection();

All your help is appreciated:
CC

Reply With Quote
  #2  
Old May 9th, 2003, 10:55 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
I do not use Tomcat connection pooling as we use Websphere, but here is the how-to for JNDI connection pooling in Tomcat. Hope it helps
http://jakarta.apache.org/tomcat/to...ples-howto.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Problem with Tomcat and Oracle 9i


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT