A sign Applet unable to load "oracle.jdbc.OracleDriver" class

hi,
i am chiranjit , i am now working in a web based ERP. where i am using a signed applet which unable to load "oracle.jdbc.OracleDriver" class but it easily loading "sun.jdbc.odbc.JdbcOdbcDriver", i am also giving my code:
import java.sql.*;
import java.math.*;
import java.io.*;
import java.awt.*;
class JdbcTest extends Applet{
public static void main (String args[]) throws SQLException {
// Load Oracle driver
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
// Connect to the local database
Connection conn =
DriverManager.getConnection
("jdbc:oracle:thin:@192.168.16.7:1521:kris",
"plsql", "oracle");
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("SELECT FIRST_NAME FROM
AUTHORS");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));
// Close the result set, statement, and the connection
rset.close();
stmt.close();
conn.close();
}

Hint: The sun.jdbc.odbc.JdbcOdbcDriver is available in any JRE distribution. The Oracle driver is not.

Similar Messages

  • Unable to load oracle.jdbc.driver.OracleDriver class

    i want to connect my java application with oracle database but i m getting an error -"class not found exception oracle.jdbc.driver.OracleDriver " which is written in Class.forName() to register the driver for DriverManager.
    plz help me..

    This is an old class, not included with the JDK anymore. It was made obsolete by
    DataSource which is a connection pool and not a single connection.

  • Help - Could not load 'oracle.jdbc.driver.OracleDriver ...

    I'm using oci8 to connect to the Oracle database.
    URL: jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(PORT=1527)(HOST=testhost)))(CONNECT_DATA=(SID=fnoe2pa)))
    When I tried to start the weblogic server, I got the following errors:
    Can you suggest what I should do next (step-wise)??? Thanks, Bobby
    <Sleeping in createResource()>
    ####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
    <main> <system> <> <001060> <Cannot startup connection pool
    "pool/test_myapp" weblogic.common.ResourceException:
    Could not load 'oracle.jdbc.driver.OracleDriver
    If this is a type-4 JDBC driver, it could occur if the JDBC
    driver is not in the system CLASSPATH.
    If this is a type-2 JDBC driver, it may also indicate that
    the Driver native layers(DBMS client lib or driver DLL)
    have not been installed properly on your system
    or in your PATH environment variable.
    This is most likely caused by one of the following:
    1. The native layer SO, SL, or DLL could not be found.
    2. The file permissions on the native layer SO, SL, or DLL
    have not been set properly.
    3. The native layer SO, SL, or DLL exists, but is either
    invalid or corrupted.
    For more information, read the installation documentation
    for your JDBC Driver, available from:
    http://e-docs.bea.com
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:212)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:134)
         at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:705)
         at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:282)
         at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:650)
         at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
         at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:360)
         at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:285)
         at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:239)
         at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:199)
         at java.lang.reflect.Method.invoke(Native Method)
         at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
         at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
         at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
         at $Proxy31.updateDeployments(Unknown Source)
         at weblogic.management.configuration.ServerMBean_CachingStub.updateDeployments(ServerMBean_CachingStub.java:2977)
         at weblogic.management.mbeans.custom.ApplicationManager.startConfigManager(ApplicationManager.java:372)
         at weblogic.management.mbeans.custom.ApplicationManager.start(ApplicationManager.java:160)
         at java.lang.reflect.Method.invoke(Native Method)
         at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
         at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
         at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
         at $Proxy42.start(Unknown Source)
         at weblogic.management.configuration.ApplicationManagerMBean_CachingStub.start(ApplicationManagerMBean_CachingStub.java:480)
         at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
         at weblogic.management.Admin.finish(Admin.java:644)
         at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
         at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
         at weblogic.Server.main(Server.java:35)
    >
    ####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
    <main> <system> <> <001082> <Creating Data Source named
    jdbc/test_myapp for pool pool/test_myapp>
    ####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
    <main> <system> <> <001070> <Checking existence of connection pool
    pool/test_myapp requested by user system>
    ####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
    <main> <system> <> <001059> <Error during Data Source creation:
    weblogic.common.ResourceException: DataSource(jdbc/test_myapp) can't
    be created with non-existent Pool (connection or multi)
    (pool/test_myapp)>
    ####<15/08/2002 14:09:50> <Info> <EJB> <qawebmethods> <myserver>
    <main> <system> <> <010008> <EJB Deploying file: myapp-ejb.jar>
    ####<15/08/2002 14:09:50> <Warning> <J2EE> <qawebmethods> <myserver>
    <main> <system> <> <160007> <You are running WebLogic Server with J2EE
    1.3 features enabled. The implementation of specific J2EE 1.3 features
    (EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
    in BEA WebLogic Server 6.1 is of a non-final version of the
    appropriate specification. It is subject to change in future releases
    once the specification becomes finalized. This may cause application
    code developed for BEA WebLogic Server 6.1 that uses the new features
    of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
    future releases of BEA WebLogic Server.>
    ####<15/08/2002 14:09:59> <Error> <J2EE> <qawebmethods> <myserver>
    <main> <system> <> <160001> <Error deploying application myapp-ejb:
    Unable to deploy EJB: Counter from myapp-ejb.jar:
    The DataSource with the JNDI name: jdbc/test_myapp could not be
    located. Please ensure that the DataSource has been deployed
    successfully and that the JNDI name in your EJB Deployment descriptor
    is correct.
    >
    ####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101053> <[HTTP myserver] Loading web app: myapp>
    ####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101059> <[myserver] Loading myapp from WAR file:
    C:\bea\wlserver6.1\.\config\mydomain\applications\.wlnotdelete\wlap31483\myapp.war>
    ####<15/08/2002 14:09:59> <Warning> <J2EE> <qawebmethods> <myserver>
    <main> <system> <> <160007> <You are running WebLogic Server with J2EE
    1.3 features enabled. The implementation of specific J2EE 1.3 features
    (EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
    in BEA WebLogic Server 6.1 is of a non-final version of the
    appropriate specification. It is subject to change in future releases
    once the specification becomes finalized. This may cause application
    code developed for BEA WebLogic Server 6.1 that uses the new features
    of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
    future releases of BEA WebLogic Server.>
    ####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101031>
    <[WebAppServletContext(1412030,myapp,/myapp)] extracting classfiles to
    C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp:>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101032>
    <[WebAppServletContext(1412030,myapp,/myapp)] extracted classfiles
    successfully...>
    ####<15/08/2002 14:10:04> <Info> <HTTP Session> <qawebmethods>
    <myserver> <main> <system> <> <100037> <Creating SessionContext of
    type: memory for webapp: /myapp>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101047>
    <[WebAppServletContext(1412030,myapp,/myapp)] registering classpath
    servlet with initArgs 'null'>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101047>
    <[WebAppServletContext(1412030,myapp,/myapp)] registering getior
    servlet with initArgs 'null'>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101047>
    <[WebAppServletContext(1412030,myapp,/myapp)] registering tunneling
    servlets with initArgs 'wl-dispatch-policy=direct'>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101047>
    <[WebAppServletContext(1412030,myapp,/myapp)] registering JSPServlet
    with initArgs '[JspConfig:
    verbose=true,packagePrefix=jsp_servlet,-compiler=javac,compileFlags=,workingDir=C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp,pageCheckSeconds=1,superclass=null,keepgenerated=false,precompileContinue=false,compilerSupportsEncoding=true,encoding=null,defaultfilename=index.jsp,compilerclass=null,noTryBlocks=false]'>
    ####<15/08/2002 14:10:04> <Debug> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101097> <Registering ServletContext:
    "myapp:/myapp">
    ####<15/08/2002 14:10:04> <Info> <J2EE> <qawebmethods> <myserver>
    <main> <system> <> <160003> <Deployed : myapp>
    ####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
    <main> <system> <> <101133> <Initializing WEB server myserver>
    ####<15/08/2002 14:10:04> <Notice> <Management> <qawebmethods>
    <myserver> <main> <system> <> <141052> <Application Poller started for
    development server.>
    ####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
    <myserver> <ListenThread> <system> <> <000202> <ListenThread listening
    on port 7001>
    ####<15/08/2002 14:10:04> <Info> <NT Performance Pack> <qawebmethods>
    <myserver> <ListenThread> <system> <> <000000> <NATIVE: NTSocketMuxer
    was built on Nov 1 2001 16:39:28
    >
    ####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
    <myserver> <SSLListenThread> <system> <> <000202> <SSLListenThread
    listening on port 7002>
    ####<15/08/2002 14:10:05> <Notice> <Management> <qawebmethods>
    <myserver> <main> <system> <> <141030> <Starting discovery of Managed
    Server... This feature is on by default, you may turn this off by
    passing -Dweblogic.management.discover=false>
    ####<15/08/2002 14:10:05> <Notice> <WebLogicServer> <qawebmethods>
    <myserver> <main> <system> <> <000331> <Started WebLogic Admin Server
    "myserver" for domain "mydomain" running in Development Mode>
    ####<15/08/2002 14:10:11> <Info> <NT Performance Pack> <qawebmethods>
    <myserver> <ExecuteThread: '14' for queue: 'default'> <> <> <000000>
    <Allocating: '2' NT reader threads>
    ####<15/08/2002 14:10:13> <Info> <HTTP> <qawebmethods> <myserver>
    <ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
    <> <101047> <[WebAppServletContext(5367844,console,/console)] actions:
    init>
    ####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
    <ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
    <> <101047> <[WebAppServletContext(5367844,console,/console)]
    FileServlet: init>
    ####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
    <ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
    <> <101047> <[WebAppServletContext(5367844,console,/console)]
    FileServlet: Using standard I/O>

    "thorick" <[email protected]> wrote in message news:<[email protected]>...
    Most likely, the OCI libraries could not be loaded.
    Before continuing down this path, is there any reason
    why you want to use an OCI based Driver as opposed to the
    all Java Oracle thin driver ?There is indeed a valid reason for my choice.
    I am currently connecting to the Oracle "Rdb" 7.0 database (located on
    VMS) - not Oracle Oracle.
    The SQL Service software we're currently using is version 7.1. This
    version works well with the OCI8 driver (when connecting to the
    database from Windows NT). This version of SQL Service however does
    NOT work for the THIN driver (unless we upgrade the SQL Service to
    version 7.1.5.5 - which we're not prepared to do so because it is not
    stable enough from our previous test/trials). SQLSRV Version 7.1.5.5
    works for THIN driver but it will result in uncommitted
    transactions/unresolved connection/stopping of listener issues and
    there is a need to restart the service from time to time. Oracle has
    since confirmed that this is a bug that they have yet to resolve...
    So we have to stick to OCI8 (THICK) for the time being. I would really
    appreciate it very much if you can tell me the various OCI libraries
    that I need to load (in terms of WebLogic Server config file settings
    etc..).
    By the way I have already installed the Oracle 8 client software on
    the NT server (where WebLogic Server is) and I have also set up the
    relevant SID (using the Net8 Assistant) that points to the Oracle Rdb
    database on the VMS. I have also tried using SQL*Plus to connect to
    the database and I can connect properly to the database. But WebLogic
    simply doesn't seem to load the software.
    Help...
    Regards,
    Bobby Brown, writing from Australia.

  • Win2000+weblogic510+oracle8i,Could not load 'oracle.jdbc.driver.OracleDriver'

    &#26143;&#26399;&#22235; &#19977;&#26376; 23 20:30:17 GMT+08:00 2000:<E> <JDBC Pool>
    Failed to create connection pool "ejavaPool"
    weblogic.common.ResourceException: Could not load 'oracle.jdbc.driver.OracleDriver'
    because
    System.loadLibrary threw java.lang.UnsatisfiedLinkError
    with the message 'oracle.jdbc.driver.OracleDriver'.
    This could occur if the JDBC driver is not in the weblogic.class.path.
    If this is a type-2 JDBC driver, it may also indicate that
    the Driver native layers(DBMS client lib or driver DLL)
    have not been installed properly on your system or in your environment.
    This is most likely caused by one of the following:
    1. The native layer SO, SL, or DLL could not be found.
    2. The file permissions on the native layer SO, SL, or DLL
    have not been set properly.
    3. The native layer SO, SL, or DLL exists, but is either
    invalid or corrupted.
    For more information, read the installation documentation
    for your JDBC Driver, available from:
    http://www.weblogic.com/docs/install/install_jdbc.html
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:82)
         at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:97)
         at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:328)
         at weblogic.jdbc.common.internal.JdbcInfo.initPools(JdbcInfo.java, Compiled Code)
         at weblogic.jdbc.common.internal.JdbcInfo.startup(JdbcInfo.java:220)
         at weblogic.jdbc.common.internal.JdbcStartup.main(JdbcStartup.java:11)
         at java.lang.reflect.Method.invoke(Native Method)
         at weblogic.t3.srvr.StartupThread.runMain(StartupThread.java:219)
         at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java, Compiled Code)
         at weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java:62)
    any idea?

    If you are trying to use the thin driver you need to make sure you have the
    classes12.zip file in the weblogic server classpath. You can download this
    driver from Oracle website.
    hth
    sree
    "meijunyong" <[email protected]> wrote in message
    news:[email protected]...
    >
    &#26143;&#26399;&#22235; &#19977;&#26376; 23 20:30:17 GMT+08:00 2000:<E><JDBC Pool>
    Failed to create connection pool "ejavaPool"
    weblogic.common.ResourceException: Could not load'oracle.jdbc.driver.OracleDriver'
    because
    System.loadLibrary threw java.lang.UnsatisfiedLinkError
    with the message 'oracle.jdbc.driver.OracleDriver'.
    This could occur if the JDBC driver is not in the weblogic.class.path.
    If this is a type-2 JDBC driver, it may also indicate that
    the Driver native layers(DBMS client lib or driver DLL)
    have not been installed properly on your system or in your environment.
    This is most likely caused by one of the following:
    1. The native layer SO, SL, or DLL could not be found.
    2. The file permissions on the native layer SO, SL, or DLL
    have not been set properly.
    3. The native layer SO, SL, or DLL exists, but is either
    invalid or corrupted.
    For more information, read the installation documentation
    for your JDBC Driver, available from:
    http://www.weblogic.com/docs/install/install_jdbc.html
    atweblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvF
    actory.java:82)
    atweblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFacto
    ry.java:97)
    atweblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:328
    at weblogic.jdbc.common.internal.JdbcInfo.initPools(JdbcInfo.java,Compiled Code)
    at weblogic.jdbc.common.internal.JdbcInfo.startup(JdbcInfo.java:220)
    at weblogic.jdbc.common.internal.JdbcStartup.main(JdbcStartup.java:11)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.t3.srvr.StartupThread.runMain(StartupThread.java:219)
    at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java, CompiledCode)
    atweblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java:62)
    any idea?

  • Load Oracle JDBC Driver by reflection.

    Hi!
    I'm trying to load driver by reflection like this,
    try {
      URL ora8libURL = new URL("file:///C:/oracle/product/10.2.0/clientDev/jdbc/lib/classes12.jar");
      Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora8libURL}));
        Enumeration<Driver> drivers = DriverManager.getDrivers();
        while(drivers.hasMoreElements())
          Driver drv = drivers.nextElement();
          System.out.println(drv.getClass().getName());
      conn = DriverManager.getConnection("jdbc:oracle:thin:@//192.168.186.13:1521/rdb817","user","password");
    catch(ClassNotFoundException ex) {ex.printStackTrace();}
    catch(MalformedURLException ex) {ex.printStackTrace();}
    catch (SQLException ex) {ex.printStackTrace();}but i've got this error:
    sun.jdbc.odbc.JdbcOdbcDriver
    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//192.168.186.13:1521/rdb817
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
    ...However, when i specify driver explicit in classpath it works fine.
    Help.

    I had the same problem you have, until i read your post :-).
    Now, with your help, i found a solution.
    The problem with your code is that the DriverManager that you are using doesn't "see" the driver you are loading. But you can create the driver instance directly:
    * Testes.java
    * Created on 31 de Julho de 2007, 15:04
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    import java.sql.*;
    import java.net.*;
    import java.util.*;
    * @author paulo
    public class Testes {
        /** Creates a new instance of Testes */
        public Testes() {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            String dbUrl10_1 = "jdbc:oracle:thin:@(DESCRIPTION="
                            + "(ADDRESS_LIST="
                            + "     (ADDRESS="
                            + "          (PROTOCOL=TCP)"
                            + "          (HOST=ffcluster01-vip)"
                            + "          (PORT=1521)"
                            + "     )"
                            + "     (ADDRESS="
                            + "          (PROTOCOL=TCP)"
                            + "          (HOST=ffcluster02-vip)"
                            + "          (PORT=1521)"
                            + "     )"
                            + "     (LOAD_BALANCE=yes)"
                            + ")"
                            + "(CONNECT_DATA="
                            + "     (SERVICE_NAME=bh.hdff.pt)"
                            + "     (FAILOVER_MODE ="
                            + "          (TYPE = SELECT)"
                            + "          (METHOD = BASIC)"
                            + "          (RETRIES = 180)"
                            + "          (DELAY = 5)"
                            + "     )"
                            + ")"
                            + ")";
            String dbUrl10_2 = "jdbc:oracle:thin:@ffcluster01:1521:BH1";
            String dbUrl7 = "jdbc:oracle:thin:@7.30.5.1:1521:HFF";
            try {
                 //Class.forName("oracle.jdbc.OracleDriver");
                URL ora7libURL = new URL("file:///C:\\PAULO\\aplicacoes\\ojdbc14.jar");
                URL ora10libURL = new URL("file:///C:\\PAULO\\aplicacoes\\ojdbc14_10g.jar");
                Driver drv10 = (Driver)(Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora10libURL}))).newInstance();
                System.out.println("Versao 10: "+drv10.getMajorVersion()+"."+drv10.getMinorVersion()+"\n");
                Driver drv7 = (Driver)(Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora7libURL}))).newInstance();
                System.out.println("Versao 7: "+drv7.getMajorVersion()+"."+drv7.getMinorVersion()+"\n");
                Enumeration drivers = DriverManager.getDrivers();
                while(drivers.hasMoreElements()) {
                    Driver drv = (Driver)drivers.nextElement();
                    System.out.println(drv.getClass().getName());
                    System.out.println("Versao: "+drv.getMajorVersion()+"."+drv.getMinorVersion()+"\n");
                System.out.flush();
                Properties prt = new Properties();
                prt.setProperty("user", "****");
                prt.setProperty("password", "*****");
                Connection conn = drv10.connect(dbUrl10_1,prt);
                conn.close();
                prt = new Properties();
                prt.setProperty("user", "****");
                prt.setProperty("password", "****");
                conn = drv7.connect(dbUrl7,prt);
                conn.close();
            } catch(ClassNotFoundException ex) {
                ex.printStackTrace();
            } catch(MalformedURLException ex) {
                ex.printStackTrace();
            } catch(SQLException ex) {
                ex.printStackTrace();
            } catch(Exception ex) {
                ex.printStackTrace();
    }Has you can see, the DriverManager doesn't know about the divers loaded with the new ClassLoader.
    The only thing you have to pay attention is not to have the classes for "oracle.jdbc.OracleDriver" in your system classpath.

  • Oralce 10G2 JDBC Driver - Error Loading oracle.jdbc.driver.OracleDriver

    When attemping to use the 10G2 jdbc driver the following NoClassDefFoundError is encountered:
    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: oracle.jdbc.driver.OracleDriver
    <<No stacktrace available>>
    Caused by: java.lang.ClassNotFoundException: oracle.security.pki.OracleWallet not found in [file:./, file:ojdbc1410g2.jar, file:/usr/share/java/libgcj-3.4.4.jar, file:./, core:/]
    <<No stacktrace available>>
    The error does not occur when reverting back to the 9 jdbc driver. Does anyone know what is causing this behavior?
    Regards,
    Paul

    Paul,
    Actually, class "oracle.jdbc.OracleDriver" extends class "oracle.jdbc.driver.OracleDriver".
    So check the JAR files in the list displayed by your error message and see if any of them contain the [missing] class, for example:
    jar tvf ojdbc1410g2.jar oracle/jdbc/driver/OracleDriver.classGood Luck,
    Avi.

  • Java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver

    Hi everyone,
    Can any one plz help me with this problem in connection with the database...im unable to connect from the servlet where my jdbc connectivity code is written when i compile it gives me this error:
    Ljava.lang.String;@e53220java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:164)
         at shoppingcart.shoppingcartservlet.doit(shoppingcartservlet.java:83)
         at shoppingcart.shoppingcartservlet.doPost(shoppingcartservlet.java:30)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)

    Hi
    The server is not able to load the jdbc driver path. Place your driver in server classpath
    Venkat

  • Java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver

    I am trying to connect from a servlet running in Tomcat on my desktop to an instance of Personal Oracle9i running on my desktop. I am gettiung NoClassDefFoundError. The code compiles.
    I know it is a path issue but I am at a loss to figure out where. Tomcat does not find the driver however it is in my machines path.
    Running following:
    j2sdk1.4.1_02
    Personal Oracle 9.2
    Tomcat 4.1.29
    Windows XP
    I have added the location of Classes12.zip to the class path: .;c:\Sun\AppServer\lib\j2ee.jar;c:\Sun\AppServer\lib\j2ee-svc.jar;d:\oracle\ora92\jdbc\lib\classes12.zip;
    The "root cause" of error is:
    java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
         at OOP.OracleConnectionDemo.doPost(OracleConnectionDemo.java:34)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    The code is as follows:
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jdbc.OracleDriver;
    //import oracle.jdbc.driver.*; //did not work either
    public class OracleConnectionDemo extends HttpServlet {
         public void doPost(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, IOException{
              Connection con = null;
              // Load the Oracle JDBC driver
              try{
                   //two versions did not work
                   //DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver);
              DriverManager.registerDriver(new OracleDriver());
         con = DriverManager.getConnection
                   ("jdbc:oracle:thin:@micron.1521:MCAP","scott","scott");     
              catch (SQLException e){
              catch (Exception e){
              finally{
                   try{
                        if (con != null)
                   con.close();
              catch(SQLException ignored){
              }//finally
    }

    What you should be realizing is that Tomcat doesn't give a hoot about your system CLASSPATH. It totally ignores it. You really shouldn't even have one, because IDEs and app servers don't even take it into account. Get rid of it.
    You're making lots of mistakes here:
    (1) The Tomcat docs explicitly state that it won't look inside ZIP files. Change it to a JAR file.
    (2) You're using JDK 1.4.1 and classes12.zip? You realize, of course, that there's an ojdbc14.jar available for download from Oracle. Go get it.
    (3) Put the JDBC JAR in the WEB-INF/lib directory of your Web app. If you don't have one, you're not deploying your Web app properly.
    (4) You've got Java code with empty catch blocks? That's one of the most foolish things a person can do. If an exception's thrown you'll never know it. For goodness sake, at least print the stack trace.
    (5) Why do you have those Oracle imports? That ties your code to Oracle. The design of the java.sql package lets you use interfaces. Why don't you write JDBC the way it was meant to be written?
    (6) Why aren't you setting up a JNDI data source?
    %

  • Location of 'oracle.jdbc.OracleDriver'

    Hi everyone,
    I am starting out learning JDBC and am trying to compile and run this sample Java program:
    package project1;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import oracle.jdbc.OracleDriver;
    public class jdbc_test1 {
    * @param args
    * @throws SQLException
    public static void main (String[] args) throws SQLException {
    try {
    DriverManager.registerDriver(new OracleDriver());
    catch (SQLException e) {
    e.printStackTrace();
    Runtime.getRuntime().exit(1);
    When I 'make' the project, I get the error 'OracleDriver not found' on the 'import' line.
    My environment:
    Windows Vista
    Oracle 10.2.0.3.0
    JDeveloper 10.1.3.3 and 11.1.1
    CLASSPATH: .;d:\App\Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;d:\App\Oracle\product\10.2.0\db_1\jlib\orai
    18n.jar
    I searched both jar files looking for OracelDriver, but found nothing. What am I missing?
    Thanks.
    rr

    I get the error 'OracleDriver not found' Note that this kind of driver to be imported is depreciated.....
    http://forums.oracle.com/forums/ann.jspa?annID=201
    As a substitution for this use....the following packages....
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    and make then the appropriate changes in your main() method... such as:
    public static void main(String args[]) throws Exception
       Connection con =null;
       try
         OracleDataSource ods = new OracleDataSource();    
         ods.setURL("jdbc:oracle:thin:scott/tiger@//<host_name>:<listener_port>/<your_tns>");
         con = ods.getConnection();
       catch (Exception ex)
         //System.out.println("Unable to connect..."+ex.printStackTrace());
         System.out.println("Unable to connect..."+ex);
         System.exit(-1);
       }Greetings...
    Sim

  • Connect to an Oracle database by using oracle.jdbc.OracleDriver: error

    Hi,
    I'm trying to connect to an Oracle database so we can retrieve notes of tables, views and packages.
    By using the API of Data Modeler (transformation script) we want to add these notes to corresponding objects in Data Modeler.
    I'm starting with this:
    importPackage(java.lang);
    importPackage(java.awt);
    importPackage(java.sql); 
    java.lang.Class.forName("oracle.jdbc.OracleDriver");
    An error occurs when I run this code:
    It has to be a Java thing...
    Anyone a suggestion?

    Problem solved! One of my colleagues referred to this post: Import user defined properties from Oracle Designer
    More in detail: it's about this couple of lines:
    // Copy the ojdbc6.jar file to ..\datamodeler-home\jlib directory 
    // Add this line to datamodeler.conf 
    //      AddJavaLibFile  ../../jlib/ojdbc6.jar 
    I changed my datamodeler.conf file, restarted DM and now there's no longer an error when I am trying to use the Oracle JDBC drive.

  • Oracle jdbc driver class and classes12.jar whether deprecated.?

    Hi All,
    1. In one of the post, it has been told that oracle.jdbc.driver.OracleDriver will be deprecated and also recommended to used oracle.jdbc.OracleDriver.
    According to that post, I changed the driver class name in my code as below:
    Class.forName("oracle.jdbc.OracleDriver");
    Then to check the driver name, I insert the below code:
    Enumeration<Driver> driverEnum = DriverManager.getDrivers();
    +while (driverEnum.hasMoreElements()){+
    System.out.println("driver : "driverEnum.nextElement());+
    +}+
    Below is the output:
    driver : oracle.jdbc.driver.OracleDriver@addbf1
    Even after specifying the driver class name to be used as oracle.jdbc.OracleDriver, why it is taking oracle.jdbc.driver.OracleDriver..?
    INFO : The Oracle JDBC Driver (classes12.jar) version is 10.2.0.4.0.
    2. We are using classes12.jar for developing all JDBC code. In Oracle Database 11g Release 2 (11.2.0.2.0) JDBC Drivers, there is no classes12.jar. Is this deprecated? Which jar can be used instead of classes12.jar?
    Thanks in advance.

    In Oracle Database 11g Release 2 (11.2.0.2.0) JDBC Drivers, there is no classes12.jar. Is this deprecated? Which jar can be used instead of classes12.jar?For JDBC 4.0 features ojdbc6.jar with JDK 6.0.
    For JDBC 3.0 support ojdbc 5.jar with JDK 5.0
    http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html

  • NoClassDefFoundError: oracle/jdbc/OracleDriver

    I have a servlet that is supposed to connect to an oracle database select from a table and then return the results. This works in JDeveloper but when I try to deploy it to tomcat I get an error saying the following.
    java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
         at LoginServlet.doPost(LoginServlet.java:44)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    How can I resolve this problem ?

    I have the same problem.
    I wrote a simple program as follows.
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.*;
    public class OracleConnect
    public static void main (String args []) throws SQLException
              DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
         Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@10.0.0.8:1521:ORCL","scott","tiger");
         Statement stmt = conn.createStatement ();
              ResultSet rset = stmt.executeQuery ("SELECT ename FROM emp");
              while (rset.next ())
         System.out.println (rset.getString (1));
    rset.close();
    stmt.close();
    conn.close();
    I am compiling like this.
    C;>javac -classpath c:\oracle\ora92\jdbc\lib\classes12.jar;c:\oracle\ora92\jdbc\lib\nls_charset12.jar;. OracleConnect.java
    Everything is fine upto now.
    But at the time of execution
    C:\>java OracleConnect
    Java is crying like this.
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/OracleDri
    ver at OracleConnect.main(OracleConnect.java:11)
    Can any one help me to resolve this issue please? By the way, I did not install Jdeveloper. I am using command prompt to do the stuff.
    Thanks,

  • Load oracle jdbc driver error when run applet via the web

    Hi All,
    I have built an applet which connect to database via jdbc thin driver. It works fine when I run it through the applet viewer, but got a problem when run it through the web.
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    I am using jdev9i 9.0.4 and jdk 1.4.2. The jdbc version is 9.0.1
    I have added both the classes12.zip and ojdbc14.zip in the class path and also pack them together with my applet class. Here is the code
    public class MyApplet extends Applet
    implements Runnable
    public void start()
    if(theThread == null)
    theThread = new Thread(this);
    theThread.start();
    Retrieve R = new Retrieve();
    this.MyMap = R.retrieveDesc();
    public class Retrieve
    public Retrieve()
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn=DriverManager.getConnection("jdbc:oracle:thin:@babyruth.wvu.edu:1703:devdw", User, Password);
    conn.setAutoCommit(true);
    connectStatus = true;
    public HashMap retrieveDesc()
    return map;
    I have also built one HTML page NewApplet like this
    <HTML>
    <HEAD>
    <TITLE> My New Applet</TITLE>
    </HEAD>
    <APPLET CODE="MyApplet.class" CODEBASE="menu" ARCHIVE="MyApplet.zip" WIDTH=300 HEIGHT=485>
    <!--General Settings-->
    <param name="bgcolor" value="255,255,255">
    </HTML>
    Any advice is highly appreciated
    Mei

    Sir,
    Well you haven't "packed" them correctly. Why don't you just add the driver bits to the soucebase tag? or something like that anyway...
    Sincerely,
    Slappy

  • Unable to load Oracle.DataAccess

    Hi ,
    I have created a website project on .net framework 4.0 in Visual Studio 2010 . But I am unable to add reference the Oracle.DataAccess dll. It is continously throwing the error " unable to load assembly Oracle.DataAccess . The system cannot find the file specified. "
    But when I tried adding the reference in a web application project , it gets added. But when run the project it is throwing the same error. On the web page the error thrown is this :
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Assembly Load Trace: The following information can be helpful to determine why the assembly 'Oracle.DataAccess' could not be loaded.
    === Pre-bind state information ===
    LOG: User =***********
    LOG: DisplayName = Oracle.DataAccess
    (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: Oracle.DataAccess | Domain ID: 2
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    Stack Trace:
    [BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
    System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
    System.Reflection.Assembly.Load(String assemblyString) +28
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    Any help on this , please.. I have been trying all sorts of things and nothing seems to workl.

    BadImageFormatException occurs when you have a bit mismatch.
    1) What is the TargetCPU set to when you compiled?
    2) Are you running the app on 32 bit or 64 bit OS?
    3) Confirm whether the app is running as 32 bit or 64 bit in the problem environment (open task manager, click the process tab, is there a *32 next to the name?)
    4) Did you install 32 bit Oracle client or 64 bit Oracle client?
    Cheers,
    Greg

  • Steps to load Oracle JDBC Thin driver onto Tomcat

    I have Oracle JDBC working with thin driver on my local Tomcat container and now need to put it on a server but forgot how I set it up and want to make sure I do it correctly when I put it on the server.
    Please advise if this is correct?
    1- Load the thin driver (ojdbc14.jar ) in Tomcat 4.1.27 Container into the common/lib directory
    2- Set the classpath on the Windows server to allow me to use the ojdbc14.jar driver?
    If so then I need to do this using Windows DOS where I add the thin driver to my Classpath?
    Set CLASSPATH=%CLASSPATH%;C:\TomcatHome\common\lib\servlet-api.jar;C:\TomcatHome\common\lib\ojdbc14.jar
    Or do I NOT need to set the classpath and just restart the Tomcat container??

    Thanks,
    I loaded the ojdbc14.jar file in common/lib and restarted the container and I can now connect to Oracle.
    What you mean by not needing ojdbc14 for compilation and it would be better to use a build tool[b] to do what?

Maybe you are looking for