Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

import oracle.jdbc.driver.*

843859Aug 5 2005 — edited Aug 6 2005
Hello,

I'm a JAVA rookie and I don't know how to import oracle.jdbc.driver.* :o(

1) I downloaded j2sdk1.4.2_08 from java.sun.com also with NetBeans IDE and installed

2) I have installed Oracle client in my local computer, in directory

C:\oracle\ora81\jdbc\

there is a lib/classes12.zip

and in this zip file there is class oracle/jdbc/driver/OracleDruver.java
for example

3) if I create a new project in NET BEANS and try to write a simple application like


import java.sql.*;
import oracle.jdbc.driver.*;

class JDBCVersion
{
public static void main (String args []) throws SQLException { // Load the Oracle JDBC driver DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@host:port:sid","scott","tiger");

// Create Oracle DatabaseMetaData object DatabaseMetaData meta = conn.getMetaData ();

// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion()); } }



This error occurs:

import oracle.jdbc.driver.*;

D:\oracle\NewMain.java:11: package oracle.jdbc.driver does not exist import oracle.jdbc.driver.*;
1 error



I think the problem is in importing orale.jdbc.driver.* .. I simply dont know, how to import, everywhere in helps is written set the classpath to ... but I dont know even how to set the classpath ;o(

Could anyone please help me and write me a step-by-step tutorial how to import the driver? This is one of my first programs in JAVA and I really dont know, how to deal with this problem.

Thanks a lot, Majo
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2005
Added on Aug 5 2005
5 comments
958 views