Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how to connect jdbc with oracle 8i?

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i am thiru, i am unable to connect jdbc with oracle 8i.
can anyone help to do above mentioned problem.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic