aspose file tools*
The moose likes JDBC and the fly likes how to connect jdbc with oracle 8i? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to connect jdbc with oracle 8i?" Watch "how to connect jdbc with oracle 8i?" New topic
Author

how to connect jdbc with oracle 8i?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi, i am thiru, i am unable to connect jdbc with oracle 8i.
can anyone help to do above mentioned problem.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
hi,
u can connect to Oracle through the JDBC-odbc bridge driver.
if u can connect to oracle from VB for example. u can connect useing the same dsn name.
rahul
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You need to get the current driver for your 8i database from Oracle (free download) and set your classpath to point to the classes111.zip (it's the same name for each version of Oracle but, won't reliably work with different versions) I personnally like the thin drivers instead of the OCI. Then to connect it's
try
{
//register the driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
// Get database connection.
Connection conn = DriverManager.getConnection(databaseURL,
userName, password);

}
catch (Exception ec)
{
System.out.println("Error on Connect " + ec + "\n");
}

the database url is
jdbc racle:thin:@[ip address or dns name for database]:[port of oracle listener]:[sid]

[This message has been edited by Carl Trusiak (edited June 13, 2000).]


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I tried exactly the same way as you said and when compiled with
'javac -classpath c:\oracle\ora81\jdbc\lib\classes111.zip myfile.java'
there was no error. But when I run it with
'java myfile '
I get the error
NoClassDefFound Error: oracle/jdbc/driver/OracleDriver.
What am I doing wrong.Please help
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You only included the classes111.zip file in the CLASSPATH when you compiled the program. You also need to include it when you run the program.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
To Setup Oracle JDBC driverWin95/Win98/NT.
setLASSPATH=[oracle_home]\jdbc\lib\classes111.zip,[oracle_home]\jdbc\lib\nls_claset111.zip, %CLASSPATH%
(or)
setLASSPATH=[oracle_home]\jdbc\lib\classes12.zip,[oracle_home]\jdbc\lib\nls_claset12.zip, %CLASSPATH%
import oracle.sql.*;
import oracle.jdbc.drivers.*;
Hope this helps, monty6

[This message has been edited by monty6 (edited August 02, 2000).]
 
 
subject: how to connect jdbc with oracle 8i?