This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes database connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "database connectivity" Watch "database connectivity" New topic
Author

database connectivity

dipayan chatterjee
Ranch Hand

Joined: Oct 03, 2007
Posts: 47
hi all

what is the procedure of connecting a struts application to a database . i want to connect a simple user registration application to my oracle 10g what are the steps to be followed to establish the connection


SCJP1.4 , gearing up for SCWCD 5
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There are an endless number of ways of using databases.

If you're using a modern version of Struts (1.3, 2+) there's no Struts-specific ways. S1.2 continued to support a deprecated technique from S1.1, but it's not recommended.
dipayan chatterjee
Ranch Hand

Joined: Oct 03, 2007
Posts: 47
i am using struts 1.2 in that case how can i acheive database connectivity
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

As I said, this isn't really a Struts question--you can use plain JDBC, Hibernate, iBatis, and so on, or use any of those with Spring.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

What David was trying to tell you is found here and If you are using Tomcat as a server, then you might be interested in this one.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
dipayan chatterjee
Ranch Hand

Joined: Oct 03, 2007
Posts: 47
thanks for the help

i tried out connection my application to my oracle database but i am getting the following error
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver

the line that is creating the problem i feel is
Class.forName("oracle.jdbc.OracleDriver");
Connection con=DriverManager.getConnection("jdbcracle:thin:@acer:1521:xe","system","sys");

what do you think went wrong

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

My guess is that the oracle.jdbc.OracleDriver class could not be found.

This is not, however, a Struts issue--there's a JDBC forum.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

dipayan chatterjee wrote:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver




Oracle driver JAR file needs to be in CLASSPATH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database connectivity