Class.forName(driverName); This will load the Driver.
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3878
posted
0
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.
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.ClassNotFoundExceptionracle.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
posted
0
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