Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading Oracle JDBC Driver  RSS feed

 
Reilly Morris
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • 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
 
pushpa latha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class.forName(driverName);
This will load the Driver.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!