• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading Oracle JDBC Driver

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me how to load the driver for JDBC for an Oracle database, or give me a tutorial link. I can't seem to load drivers.
Reilly
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class.forName(driverName);
This will load the Driver.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Warning -- Danger Will Robinson!
Don't try to load a Driver with the DriverManager class if you are working in an EJB container. Instead, set up a DataSource using the tools provided by your container vendor and use the DataSource to obtain connections. If you use a DriverManager the database driver's connections will NOT be enlisted in EJB transactions...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Reilly Morris
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running Oracle8 and JDK1.3.1_01. What drivers should I be using, and where might I find the name of it in my directories... I have been running this code:
import java.sql.*;
import java.math.*;
class testJDBC
{
public static void main(String []args)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection ("jdbc racle ci8:@mydatabase", "scott", "tiger");
String createTableCoffees = "CREATE TABLE COFFEES " +
"(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " +
"SALES INTEGER, TOTAL INTEGER)";

Statement stmt = conn.createStatement();
stmt.executeUpdate(createTableCoffees);
}// *********end try
catch (Exception e)
{
e.printStackTrace();
}//**********end catch
}//**********end main
}//**********end class
Is " @mydatabase" the correct syntax, and if not, where do if find the name of my database? I keep getting the error:
java.lang.ClassNotFoundException racle.jdbc.driver.OracleDriver with an associated stack of errors.
If anybody can help out here, I could really use a hand. All I want to do is write to this Oracle DB.
Reilly
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This doesn't seem like an EJB question but rather a JDBC question. I am moving this to the JDBC forum where you will get better responses.
------------------
Tom
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs
reply
    Bookmark Topic Watch Topic
  • New Topic