aspose file tools*
The moose likes Servlets and the fly likes Doing JDBC with servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doing JDBC with servlets" Watch "Doing JDBC with servlets" New topic
Author

Doing JDBC with servlets

Lucky Chawla
Greenhorn

Joined: Aug 08, 2006
Posts: 22
Hey I am having some problems in connecting my servlet with oracle9i as the database and thru the contatiner Tomcat, If i do the same the thing with servlet runner ewverything iget aces to data base,
I have pasted the classes12.jar also but , I always get the message sayin" Ubale to load drivers,

Can anybody help me, Please ???
Thanks
Lucky
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
How are you making database connection? By jndi datasource lookup or by DriverManager?

Post the code snippet which is actually making a connection with the databse.

If you are using Class.forName("oracle.jdbc.OracleDriver"), then you will get ClassNotFoundException. Check it first by printStackTrace()

Naseem


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Lucky Chawla,
Welcome to JavaRanch!

We're pleased to have you here with us in the JSP forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Lucky Chawla
Greenhorn

Joined: Aug 08, 2006
Posts: 22
Hi
I am making use DriverManager , I am unable to connect to my database.
But I tried doing this thing with JSP , and you know It works
Anyway I will post the code which i am using for database connection
Can anybody tell me the steps to connect to connect to acces as databse. If possible explain this a few line of coding
Thakns
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Lucky Chawla:
I have pasted the classes12.jar also but , I always get the message sayin" Ubale to load drivers,


Pasted where?
Lucky Chawla
Greenhorn

Joined: Aug 08, 2006
Posts: 22
I have copied the classes12.jar in lib folder of tomcat under common directory
Thanks
Lucky
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It should go under common/lib.
This is where it needs to be if you're using container managed pooling.

Since you're using the driver manager, you could also put it under WEB-INF/lib within your own application.
[ August 14, 2006: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doing JDBC with servlets