IntelliJ Java IDE
The moose likes EJB and Other Java EE Technologies and the fly likes Loading Oracle JDBC Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Loading Oracle JDBC Driver" Watch "Loading Oracle JDBC Driver" New topic
Author

Loading Oracle JDBC Driver

Reilly Morris
Ranch Hand

Joined: Sep 11, 2001
Posts: 44
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


<b>Reilly</b> <br /><i>SCJP,J2EE,OOAD,iNet+,A+,CIW,<br />MCP,--</i>
pushpa latha
Greenhorn

Joined: Nov 06, 2001
Posts: 9
Class.forName(driverName);
This will load the Driver.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3878
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.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Reilly Morris
Ranch Hand

Joined: Sep 11, 2001
Posts: 44
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

Joined: May 05, 2000
Posts: 13974
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


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
 
subject: Loading Oracle JDBC Driver
 
Threads others viewed
update driver
Loading Oracle JDBC Driver
using oracle
java.sql.SQLException: No suitable driver
Query in JDBC connection
developer file tools