Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

netBeans Oracle connection through ODBC JDBC bridge

Status
Not open for further replies.

jimi4you

Programmer
Sep 28, 2003
1
CA
Hi every one,

I am having problem connecting ORACLE through JSP. I am using netBeans IDE, though I am able to connect to ORACLE using ODBC-JDBC bridge drivers and can browse Oracle tables, but when I try it through JSP page it stucks some where.
Note- before I do this I make sure that the Oracle instance is running and Tomacat has started at localhost:8081

Here is little code for JDBC api. ("cprofile" is my Oracle Instance)

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:eek:dbc:cprofile";
Connection con = DriverManager.getConnection(url, "scott", "tiger");

Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ENAME,JOB FROM EMP");

 
Hi,

If you are connecting to ORACLE from Tomcat, you need to have classes12.jar in your Web Application lib folder. Just make sure you have this jar file, which loads the dirver for oracle.

Cheers,
-Venu
 
Once using the classes12.zip packages, your connection String will look a little different eg :

jdbc:eek:racle:thin@serverHost:1521:DatabaseSID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top