Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / March 2005

Tip: Looking for answers? Try searching our database.

Using Oracle with Tomcat

Thread view: 
Long Nguyen - 25 Mar 2005 07:55 GMT
Hi everybody

I am using Tomcat 5.5.7 and Oracle 8.1.6 on my computer (localhost). I am
trying to connect to Oracle using JNDI follow the Tomcat Documentation.

I use this to make a connection

Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();

But I got an SQL exception.

Can anyone give me some help. Thank you very much!!!
David Harper - 25 Mar 2005 08:09 GMT
> But I got an SQL exception.
>
> Can anyone give me some help. Thank you very much!

First, try reading

  http://www.catb.org/~esr/faqs/smart-questions.html

and in particular, this section:

  http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

Now you'll understand why you're not likely to get a response to your
question unless you give us more information than "I got an SQL exception".

David Harper
Cambridge, England
Juha Laiho - 25 Mar 2005 20:04 GMT
"Long Nguyen via JavaKB.com" <forum@JavaKB.com> said:
>I am using Tomcat 5.5.7 and Oracle 8.1.6 on my computer (localhost). I am
>trying to connect to Oracle using JNDI follow the Tomcat Documentation.
[quoted text clipped - 5 lines]
>DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
>Connection conn = ds.getConnection();

This code snippet seems correct, so the problem is somewhere else:
- configuration of Oracle (mainly TNS listener config)
- configuration of Tomcat
 - jndi resource configuration in server.xml
 - jndi resource mapping to application in the application-specific
   xml file (no, not the WEB-INF/web.xml, but the one in directory
   tomcat/conf/Catalina/hostname/ )
 - availability/installation of Oracle JDBC library

>But I got an SQL exception.

Well, there are quite a lot of them, and usually each of them can be
caused by numerous different failures (with the exact failure being
reported with the exception message). So, just "SQL exception" is of
no help.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.