Loadjava mysql jdbc - error

Hi!
I´m Trying to load the mysql connector into oracle database.
I create a package to connect to mysql and all that is missing is the jdbc driver.
So i executed loadjava, but i´m getting the error bellow. Can anyone help me?
Oracle database 10g
arguments: '-u' 'vendas/***@idev10g' '-v' '-resolve' '/ora10g/app/oracle/product/10.2.0/db_1/jlib/mysql-connector-java-5.1.12.jar'
dropped  : JAVA$CLASS$MD5$TABLE
Exception in thread "main" java.lang.UnsatisfiedLinkError: getClassContext
        at com.ibm.jvm.classloader.ClassLoaderUtils.getLastClassLoader(ClassLoaderUtils.java:38)
        at java.security.Provider.loadProvider(Provider.java:209)
        at java.security.Security$2.run(Security.java:434)
        at java.security.AccessController.doPrivileged1(Native Method)
        at java.security.AccessController.doPrivileged(AccessController.java:351)
        at java.security.Security.getProviderAt(Security.java:431)
        at java.security.Security.getAlgClassName(Security.java:583)
        at java.security.Security.getAlgClassName(Security.java:637)
        at java.security.Security.getImpl(Security.java:1118)
        at java.security.MessageDigest.getInstance(MessageDigest.java:135)
        at oracle.aurora.server.tools.loadjava.SchemaObject.MD5OfStream(SchemaObject.java:730)
        at oracle.aurora.server.tools.loadjava.SchemaObject.getNewMD5(SchemaObject.java:418)
        at oracle.aurora.server.tools.loadjava.SchemaObject.doCreate(SchemaObject.java:174)
        at oracle.aurora.server.tools.loadjava.SchemaObject.process1(SchemaObject.java:215)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:548)
        at oracle.aurora.server.tools.loadjava.LoadJava.addObject(LoadJava.java:529)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:467)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:396)
        at oracle.aurora.server.tools.loadjava.LoadJava.addJar(LoadJava.java:743)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:448)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:396)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:365)
        at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:668)
        at oracle.aurora.server.tools.loadjava.LoadJava.processDeferredFiles(LoadJava.java:633)
        at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:834)
        at oracle.aurora.server.tools.loadjava.LoadJava.command(LoadJava.java:267)
        at oracle.aurora.server.tools.loadjava.LoadJavaMain.run(LoadJavaMain.java:164)
        at oracle.aurora.server.tools.loadjava.LoadJavaMain.main(LoadJavaMain.java:89)

I solved it.
I had to increase the java pool memory (first time i run the server complained about it) and then load the mysql jdbc driver executing in sqlplus:
dbms_java.loadjava('path to jdbc driver file');
When executing from console, the loadjava command require extra information (LD_LIBRARY_PATH etc) giving the error i mention above.
Executing from sqlplus it is all set.

Similar Messages

  • Connection mysql jdbc error ?

    I have program java likes this :
    import java.sql.*;
    public class LoadDriver {
        // Define the JDBC Driver and the database connection URL
        public static final String DRIVER = "com.mysql.jdbc.Driver";
        public static final String URL = "jdbc:mysql://localhost/java?user=test&password=test";
        public static void main(String args[]) {
            Connection conn = null;
    Statement select = null;
    ResultSet result = null;
            try {
                // load the driver dynamically
                Class.forName(DRIVER);
                // connect to the database
                conn = DriverManager.getConnection(URL);
                // perform a query. first create a Statement object from the connection
                select = conn.createStatement();
    // next execute a query (SQL string) and return the results in a ResultSet object
                result = select.executeQuery("select fname, lname from names order by lname, fname");
                // print out the results
                while(result.next()) {
                    String fname = result.getString("fname"); // note these match the columns in the
                    String lname = result.getString("lname"); // SELECT statement (fname, lname)
                    System.out.println(fname+" "+lname);
    // check if there was a problem executing the SQL statement
            catch (SQLException e) {
                System.err.println("SQL Exception: "+e.getMessage());
                System.exit(1);
    // if the JDBC driver is not in the CLASSPATH
            catch (ClassNotFoundException e) {
                System.err.println("Class not found:  "+e.getMessage());
                System.exit(1);
    // catch any other exceptions
            catch (Exception e) {
                System.err.println("Other Exception: ");
                System.err.println(e.getMessage());
                System.exit(1);
    // You want to close the connections no matter what happens!
    finally {
    try {
    // close the result, query, and database connection
    if (result != null) result.close();
                 if (select != null) select.close();
                if (conn != null) conn.close();
    catch (SQLException e) {
    // one of the new cases where it's OK to just eat exceptions or at the most log them
    System.err.println("Error closing connection: "+e.getMessage());
      but i get errror likes this :
    D:\Program Files\Java\jdk1.5.0_03\bin>javac LoadDriver.java
    D:\Program Files\Java\jdk1.5.0_03\bin>java LoadDriver
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Sign
    ature
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at LoadDriver.main(LoadDriver.java:20)
    D:\Program Files\Java\jdk1.5.0_03\bin>
    I place mysql.jar in
    - D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext
    - D:\Program Files\Java\jdk1.5.0_03\lib
    - D:\Program Files\Java\jdk1.5.0_03\jre\lib
    and i make classpath to D:\Program Files\Java\jdk1.5.0_03\bin;D:\Program Files\Java\jdk1.5.0_03\jre\lib\ext\
    but it still doesn't work
    What must I do ?
    Thx 4 your reply

    Hello!
    I'm getting this same error message and i followed the code example as close as i could:
    Thanks for any help on this!
    bk
    set oldpath=%PATH%
    set JAVA_HOME=C:\jdk1.5.0_02
    set ANT_HOME=C:\ANT\apache-ant-1.6.5
    set PATH=C:\jdk1.5.0_02\bin;%ANT_HOME%\bin
    set CLASSPATH=.;C:\jdk1.5.0_02\lib;C:\MYSQL\mysql-connector-java-3.1.10\src\com\;C:\MYSQL\mysql-connector-java-3.1.10\src\org\;C:\MYSQL\mysql-connector-java-3.1.10\mysql-connector-java-3.1.10-bin-g.jar;
    http://www.developer.com/java/data/article.php/3417381#Critical_steps_in_using_JDBC
    import java.sql.*;
    public class Jdbc11 {
      public static void main(String args[]){
        System.out.println(
                      "Copyright 2004, R.G.Baldwin");
        try {
          Statement stmt;
          //Register the JDBC driver for MySQL.
          Class.forName("com.mysql.jdbc.Driver");
          //Define URL of database server for
          // database named mysql on the localhost
          // with the default port number 3306.
          String url =
                "jdbc:mysql://localhost:3306/mysql";
          //Get a connection to the database for a
          // user named root with a blank password.
          // This user is the default administrator
          // having full privileges to do anything.
          Connection con =
                         DriverManager.getConnection(
                                     url,"root", "");
          //Display URL and connection information
          System.out.println("URL: " + url);
          System.out.println("Connection: " + con);
          //Get a Statement object
          stmt = con.createStatement();
          //Create the new database
          stmt.executeUpdate(
                           "CREATE DATABASE JunkDB");
          //Register a new user named auser on the
          // database named JunkDB with a password
          // drowssap enabling several different
          // privileges.
          stmt.executeUpdate(
              "GRANT SELECT,INSERT,UPDATE,DELETE," +
              "CREATE,DROP " +
              "ON JunkDB.* TO 'auser'@'localhost' " +
              "IDENTIFIED BY 'drowssap';");
          con.close();
        }catch( Exception e ) {
          e.printStackTrace();
        }//end catch
      }//end main
    }//end class Jdbc11
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature

  • Mysql JDBC error

    <%@ page import = "java.io.*, java.util.*,java.net.URL,java.awt.*,java.lang.*,java.sql.*" %>
    <HTML>
    <head></head>
    <body>
    <%
        ResultSet rs;
         Statement stmt;
         try {
              Class.forName("com.mysql.jdbc.Driver").newInstance();
              Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/petrofed?user=petrofed&password=petro");
         String sql = "SELECT * FROM sample";
         stmt = conn.createStatement();
         rs = stmt.executeQuery(sql);
         while (rs.next())
              out.println(rs.getString(1));
              out.println(rs.getString(2));
                 // Do something with the Connection
             } catch (SQLException ex) {
                 // handle any errors
                 out.println("SQLException: " + ex.getMessage());
                 out.println("SQLState: " + ex.getSQLState());
                 out.println("VendorError: " + ex.getErrorCode());
             catch (ClassNotFoundException cnfex)
                           out.println("SQLException: " + cnfex.getMessage());
    %>
    </body>
    </html>
    Getting following error after uploading it on the Server
    SQLException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.security.AccessControlException MESSAGE: access denied (java.net.SocketPermission localhost resolve) STACKTRACE: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1023) at java.net.InetAddress.getAllByName0(InetAddress.java:1000) at java.net.InetAddress.getAllByName0(InetAddress.java:981) at java.net.InetAddress.getAllByName(InetAddress.java:975) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:133) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:281) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1696) at com.mysql.jdbc.Connection.(Connection.java:408) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:270) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:193) at org.apache.jsp.mysqldb2_jsp._jspService(mysqldb2_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source) at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source) at org.apache.jasper.servlet.JspServlet.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.access$0(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION ** SQLState: 08S01 VendorError: 0

    Tomcat is running with a Java security manager that doesn't let your application connect via sockets to applications outside Tomcat. You could perhaps fix this by configuring Tomcat with a security policy that does permit that, but don't ask me how to do that. I would fix the problem by using connection pools that are (I believe) built into Tomcat.

  • HELP!!, MySQL JDBC ERROR!!, Please Help!!

    I'm excecuting this JSP code, to connect to a MySQL Database on the same server as my JSP containter, but i keep getting this error when it excecutes the ResultSet's getString() method. I Can't find the mistake anywhere so if anybody can help me i would really apreciate it!!!
    TANX!!! :)
    Here's the message i get:
    ERROR CODE:0 , SQLSTATUS:S1000, MESSAGE: "before start of result set ".
    Here's the code i'm excecuting:
    String nombreBDD = "tesis";
    String nombreServidor = "localhost";
    int portnumber = 3306;
    String username = "root";
    String password = "backhoff";
    int flag = 0; //Bandera para no tener dos etiquetas XML raiz
    String no_telefono = null;
    Connection conn = null;
    Statement stmt = null; 
    ResultSet rs = null;
    MysqlDataSource mysql = new MysqlDataSource();
    mysql.setDatabaseName(nombreBDD);          
    mysql.setServerName(nombreServidor);           
    mysql.setPortNumber(portnumber);     
    try
    conn = mysql.getConnection(username, password);
    }catch(SQLException e)
    String sqlState = e.getSQLState();          
    Integer i = new Integer(e.getErrorCode());
    String errorCode = i.toString();
    String message = e.getMessage();
    flag = 1;          
    out.println("Error:" + errorCode + "  Mensaje: " + message + "  Estado SQL:" + sqlState);
    e = null;
    try
    stmt = conn.createStatement();
    }catch(SQLException e)
    String sqlState = e.getSQLState();          
    Integer i = new Integer(e.getErrorCode());
    String errorCode = i.toString();
    String message = e.getMessage();
    out.println("Error:" + errorCode + "  Mensaje: " + message + "  Estado SQL:" + sqlState);
    e = null;
    try
    rs = stmt.executeQuery("SELECT * FROM alumnos");
    }catch(SQLException e)
    String sqlState = e.getSQLState();          
    Integer i = new Integer(e.getErrorCode());
    String errorCode = i.toString();
    String message = e.getMessage();
    out.println("Error:" + errorCode + "  Mensaje: " + message + "  Estado SQL:" + sqlState);
    e = null;
    try
    no_telefono = rs.getString(1); // Here's where i get the error !!!!!
    }catch(SQLException e)
    String sqlState = e.getSQLState();          
    Integer i = new Integer(e.getErrorCode());
    String errorCode = i.toString();
    String message = e.getMessage();
    out.println("Error:" + errorCode + "  Mensaje: " + message + "  Estado SQL:" + sqlState);
    e = null;
    }

    You have to loop over your result set with something like
    while(rs.next()){
    String str = rs.getString(1);
    /*add str to a data structure, such as an ArrayList if your query returns more then a record
    }Luigi

  • Unable to create : com.mysql.jdbc.Driver error with JDeveloper 10.1.3

    Hi all,
    I got this error when I tried to execute a simple JSF app. I am using JDeveloper 10.1.3 release edition. Please advice
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    **** Unable to obtain password from principals.xml. Using default.
    C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config>
    C:\JDeveloper10g\jdk\bin\javaw.exe -ojvm -classpath C:\JDeveloper10g\j2ee\home\oc4j.jar;C:\JDeveloper10g\jdev\lib\jdev-oc4j-embedded.jar -Xverify:none -DcheckForUpdates=adminClientOnly -Doracle.application.environment=development -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\config\server.xml
    [waiting for the server to complete its initialization...]
    2006-01-31 21:40:47.062 NOTIFICATION Auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\dms.war...
    2006-01-31 21:40:47.093 NOTIFICATION Unjar C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\dms.war in C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\dms
    2006-01-31 21:40:47.093 NOTIFICATION Finished auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\dms.war
    2006-01-31 21:40:47.156 NOTIFICATION Auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\connectors\datasources\datasources.rar...
    2006-01-31 21:40:47.156 NOTIFICATION Unjar C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\connectors\datasources\datasources.rar in C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\connectors\datasources\datasources
    2006-01-31 21:40:47.171 NOTIFICATION Finished auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\connectors\datasources\datasources.rar
    2006-01-31 21:40:47.218 NOTIFICATION Auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j.ear...
    2006-01-31 21:40:47.281 NOTIFICATION Unjar C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j.ear in C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j
    2006-01-31 21:40:47.359 NOTIFICATION Finished auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j.ear
    2006-01-31 21:40:47.375 NOTIFICATION Auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j\webapp.war...
    2006-01-31 21:40:47.375 NOTIFICATION Unjar C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j\webapp.war in C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j\webapp
    2006-01-31 21:40:59.296 NOTIFICATION Finished auto-unpacking C:\JDeveloper10g\jdev\system\oracle.j2ee.10.1.3.36.73\embedded-oc4j\applications\bc4j\webapp.war
    2006-01-31 21:41:08.421 WARNING J2EE OJR0107 Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    06/01/31 21:41:08 SEVERE: ApplicationStateRunning.initConnector Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    Jan 31, 2006 9:41:08 PM com.evermind.server.ApplicationStateRunning initConnector
    SEVERE: Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    06/01/31 21:41:08 SEVERE: ApplicationStateRunning.initConnector Stack trace: oracle.oc4j.sql.DataSourceException: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnectionPool(ApplicationStateRunning.java:2016)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1961)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1220)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:356)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:208)
         at com.evermind.server.Application.setConfig(Application.java:391)
         at com.evermind.server.Application.setConfig(Application.java:309)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1771)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1532)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:939)
         at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.resource.ResourceException: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at oracle.oc4j.sql.spi.ResourceAdapterImpl.createDataSourceConnectionPool(ResourceAdapterImpl.java:106)
         at oracle.oc4j.sql.DataSourceUtils.getDataSourceConnectionPool(DataSourceUtils.java:322)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnectionPool(ApplicationStateRunning.java:1997)
         ... 11 more
    Caused by: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createConnectionFactory(DataSourceConfigUtils.java:247)
         at oracle.oc4j.sql.DataSourceConnectionPoolImpl.<init>(DataSourceConnectionPoolImpl.java:107)
         at oracle.oc4j.sql.spi.ResourceAdapterImpl.createDataSourceConnectionPool(ResourceAdapterImpl.java:99)
         ... 13 more
    Caused by: oracle.classloader.util.AnnotatedClassNotFoundException:
         Missing class: com.mysql.jdbc.Driver
         Dependent class: oracle.oc4j.sql.config.DataSourceConfigUtils
         Loader: oc4j:10.1.3
         Code-Source: /C:/JDeveloper10g/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in C:\JDeveloper10g\j2ee\home\oc4j.jar
    This load was initiated at current-workspace-app.root:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound(PolicyClassLoader.java:2061)
         at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoader.java:1665)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1621)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1606)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:242)
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createConnectionFactory(DataSourceConfigUtils.java:244)
         ... 15 more
    Jan 31, 2006 9:41:08 PM com.evermind.server.ApplicationStateRunning initConnector
    SEVERE: Stack trace: oracle.oc4j.sql.DataSourceException: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnectionPool(ApplicationStateRunning.java:2016)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1961)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1220)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:356)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:208)
         at com.evermind.server.Application.setConfig(Application.java:391)
         at com.evermind.server.Application.setConfig(Application.java:309)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1771)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1532)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:939)
         at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:113)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.resource.ResourceException: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at oracle.oc4j.sql.spi.ResourceAdapterImpl.createDataSourceConnectionPool(ResourceAdapterImpl.java:106)
         at oracle.oc4j.sql.DataSourceUtils.getDataSourceConnectionPool(DataSourceUtils.java:322)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnectionPool(ApplicationStateRunning.java:1997)
         ... 11 more
    Caused by: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createConnectionFactory(DataSourceConfigUtils.java:247)
         at oracle.oc4j.sql.DataSourceConnectionPoolImpl.<init>(DataSourceConnectionPoolImpl.java:107)
         at oracle.oc4j.sql.spi.ResourceAdapterImpl.createDataSourceConnectionPool(ResourceAdapterImpl.java:99)
         ... 13 more
    Caused by: oracle.classloader.util.AnnotatedClassNotFoundException:
         Missing class: com.mysql.jdbc.Driver
         Dependent class: oracle.oc4j.sql.config.DataSourceConfigUtils
         Loader: oc4j:10.1.3
         Code-Source: /C:/JDeveloper10g/j2ee/home/lib/oc4j-internal.jar
         Configuration: <code-source> in META-INF/boot.xml in C:\JDeveloper10g\j2ee\home\oc4j.jar
    This load was initiated at current-workspace-app.root:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound(PolicyClassLoader.java:2061)
         at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoader.java:1665)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1621)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1606)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:242)
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createConnectionFactory(DataSourceConfigUtils.java:244)
         ... 15 more
    06/01/31 21:41:08 WARNING: Application.setConfig Application: current-workspace-app is in failed state as initialization failedjava.lang.InstantiationException: Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    Jan 31, 2006 9:41:08 PM com.evermind.server.Application setConfig
    WARNING: Application: current-workspace-app is in failed state as initialization failedjava.lang.InstantiationException: Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    2006-01-31 21:41:08.531 WARNING J2EE 0JR0013 Exception initializing deployed application: current-workspace-app. Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 29125 ms.

    I did what Manu suggested with no success. Alternatively, I registered the driver jar with embedded OC4J preferences > global > libraries. Still does not work. Please, note, that when I run JUnit tests against my BC4J application modules with JDBC URL as connection type, everything works just fine. The problem comes while running the JSF application when the application module is using JDBC DataSource as connection type.

  • Error : class not found exception : com.mysql.jdbc.driver in Eclipse Tool

    Hi
    I have impoted project file in eclipse in new machine using option import from existing workbence . When i stat to debug this project ,
    i am getting error as class not found exception : com.mysql.jdbc.driver . my project folder already consist of mysql .jar file in /web appls/web-inf folder.
    Application is running successfully in other machine from where i took the application file. As this error appeared I also added jar file into project path as Project ---->properties-- build java path---libraries----add external jar file.
    kindly hep me.

    Sounds like an eclipse question - not a JDBC one.
    But since eclipse is telling you it can't find it then it means it is not in the eclipse path. So you must add it. (The fact that it is somewhere is irrelevant - all that matters is it is not in the class path.)

  • Error in Class.forName("com.mysql.jdbc.driver")

    Hi forum,
    Please help me to solve the issue.
    im using the following jsp code for genrating the reports using JASPER REPORTS
    the JSP FILE
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="javax.sql.DataSource"%>
    <%@ page import="javax.naming.InitialContext"%>
    <%@ page import="net.sf.jasperreports.engine.*"%>
    <%@ page import="net.sf.jasperreports.engine.design.JasperDesign"%>
    <%@ page import="net.sf.jasperreports.engine.xml.JRXmlLoader"%>
    <%@ page import="net.sf.jasperreports.engine.export.*" %>
    <%@ page import ="net.sf.jasperreports.engine.*"%>
    <%@ page import ="net.sf.jasperreports.engine.JasperFillManager"%>
    <%@ page import ="net.sf.jasperreports.engine.JRException"%>
    <%@ page import="net.sf.jasperreports.engine.JasperReport"%>
    <%@ page import="net.sf.jasperreports.engine.JasperPrint"%>
    <html>
    <body bgcolor="00ffcc">
    <%
    try{
    Connection con = null;
    String url="jdbc:mysql://localhost/customer";
    String username = "root";
    String password = "cmsadmin";
    InputStream input=new FileInputStream(new File("C:/Documents and Settings/user/My Documents/NetBeansProjects/jasperreports/web/helloworld.xml"));
    JasperDesign design = JRXmlLoader.load(input);
    JasperReport report = JasperCompileManager.compileReport(design);
    Map params = new HashMap();
    params.put("reportTitle", "helloworld");
    params.put("author", "Muthu Kumar");
    params.put("startDate", (new java.util.Date()).toString());
    params.put("ReportTitle", "PDF JasperReport");
    <img class="emoticon" src="images/emoticons/confused.gif" border="0" alt="" />Class.forName("com.mysql.jdbc.Driver");<img class="emoticon" src="images/emoticons/confused.gif" border="0" alt="" /><img src="images/emoticons/confused.gif" border="0" alt="" />
    con = DriverManager.getConnection(url,username,password);
    JasperPrint print = JasperFillManager.fillReport(report, params, con);
    OutputStream output=new FileOutputStream(new File("C:/Documents and Settings/user/My Documents/NetBeansProjects/jasperreports/helloreportworld.pdf"));
    JasperExportManager.exportReportToPdfStream(print, output);
    // JasperViewer.viewReport(print);
    catch(SQLException es) {
    out.println(es);
    catch(JRException ex){
    //ex.printStackTrace();
    out.println(ex);
    %>
    </body>
    </html>The error it is saying is in the line Class.forName(....) ;
    Please look for the emoctions with question mark
    i DOn know what to do.
    Please help
    Im comparin the below JRXML file as with the above code
    <?xml version="1.0"?>
    <!DOCTYPE jasperReport
    PUBLIC "-//JasperReports//DTD Report Design//EN"
    "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport name="helloworld">
    <parameter name="reportTitle" class="java.lang.String"/>
    <parameter name="author" class="java.lang.String"/>
    <parameter name="startDate" class="java.lang.String"/>
    <queryString>
    <![CDATA[SELECT * FROM customer order by UserID ]]>
    </queryString>
    <field name="UserID" class="java.lang.String"/>
    <field name="UserName" class="java.lang.String"/>
    <field name="City" class="java.lang.String"/>
    <field name="State" class="java.lang.String"/>
    <title>
    <band height="60">
    <textField>
    <reportElement x="0" y="10" width="500" height="40"/>
    <textElement textAlignment="Center">
    <font size="24"/>
    </textElement>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$P{reportTitle}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="0" y="40" width="500" height="20"/>
    <textElement textAlignment="Center"/>
    <textFieldExpression class="java.lang.String">
    <![CDATA["Run by: " + $P{author}
    + " on " + $P{startDate}]]>
    </textFieldExpression>
    </textField>
    </band>
    </title>
    <columnHeader>
    <band height="30">
    <rectangle>
    <reportElement x="0" y="0" width="500" height="25"/>
    <graphicElement/>
    </rectangle>
    <staticText>
    <reportElement x="5" y="5" width="50" height="15"/>
    <textElement/>
    <text><![CDATA[UserID]]></text>
    </staticText>
    <staticText>
    <reportElement x="55" y="5" width="150" height="15"/>
    <text><![CDATA[UserName]]></text>
    </staticText>
    <staticText>
    <reportElement x="205" y="5" width="255" height="15"/>
    <text><![CDATA[City, State]]></text>
    </staticText>
    </band>
    </columnHeader>
    <detail>
    <band height="20">
    <textField>
    <reportElement x="5" y="0" width="50" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{UserID}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="55" y="0" width="150" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{UserName}]]>
    </textFieldExpression>
    </textField>
    <textField>
    <reportElement x="205" y="0" width="255" height="15"/>
    <textElement/>
    <textFieldExpression class="java.lang.String">
    <![CDATA[$F{City} + ", " + $F{State}]]>
    </textFieldExpression>
    </textField>
    </band>
    </detail>
    </jasperReport>

    Glass_Fish wrote:
    I have set the classpath in the environment variables in the my computer properties.The web container has it's own properties. The "system" classpath means absolutely nothing to it. Read your server's documentation.

  • Com.mysql.jdbc.ResultSetImpl@55a338 (error)

    I am getting this error the when i want to display the table contents of a database in Mysql..In the code i am using 2 recordset is that creating a problem..and it shows this error the number of times equal to the records present in recordset of a particular query..!!

    1. It's just localy - no internet
    2. Connection is continous.
    3. hmm what is the suitable fashion [ sorry for my ignorance ] I got this:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.from the console after I put in the code this:
       public void connector(){
               try
                   String userName = "root";
                   String password = "";
                   String url = "jdbc:mysql://localhost/log";
                   Class.forName ("com.mysql.jdbc.Driver").newInstance ();
                   conn = DriverManager.getConnection (url, userName, password);
                   System.out.println ("Database connection established");
                   System.out.println(conn);
               *catch (Exception w)*
                   *System.err.println ("Cannot connect to database server " +w);*
                  *// return false;*
        }thought is suitable = )

  • JDBC/MySQL syntax error on MySQL server login

    I am making a simple JSP page and I'm trying to test basic functionality/connectivity with a MySQL database. Included is my index.jsp code and the errors given by Tomcat. Any insights would be very helpful, thanks.
    org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 13 <%@ page import="java.sql.*"%> <% Connection con = null; Statement stmt = null; ResultSet rs = null; %> <html> <body> <% Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/database", "correctUserName", "correctPassword");    //<-line 13 stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM table"); while(rs.next()){ out.println(rs.getString("name")+"<br>"); } rs.close(); %> </body </html> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.servlet.ServletException: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.index_jsp._jspService(index_jsp.java:86) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    chrislard wrote:
    That is a good idea for actual implementation, but this is just a test. There isn't any reason that this should not work because it hasn't been broken up into multiple files etc.Evidence would indicate that it is not in fact working though. And the error indicates a syntax error. Because it is JSP there is no assured way to localize the problem, not to mention that since it is running is a container there is no assurance that the posted code is even what is running.
    My suggestion on the other hand completely eliminates all of those possibilities.
    But if it helps you the posted SQL does not have any syntax errors. So if you can solve the problem that you have knowing just that then go for it. Myself I would at least create a test jig.

  • Very urgent !!!!!!!! Jdbc error  mysql error

    hii
    i am not been able to connected to d/b ,i am using mySQL..
    so plz tell me the soln.i have downloaded the connector j and set the class path..now tell me how to connect the d/b..also tell me how to that we r connectd to the database ,if possible send me the whole code..it will veru good help...
    thanks...
    take care.
    Rahul

    Hii essube
    i am u code for all my classes
    1.Database class(just does the Connection to D/B)
    2.LanguageFunctions class(class which does the Proccessing)
    3.LanguageDetailsServlet class(Servlet)
    1.Databaseclass
    package Langpack;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.net.URL;
    public class Databaseclass
    Databaseclass objDatabaseclass=new Databaseclass();
    Connection con=null;
    public Databaseclass()
    System.out.println("Me inside the Database Class");
    protected Connection openConnection()
    // Init the properties
    Properties moConnectionProperties = new Properties();
    moConnectionProperties.put("host", "localhost");
    moConnectionProperties.put("port", "3306");
    moConnectionProperties.put("database", "BAEKO");
    moConnectionProperties.put("driver", "com.mysql.jdbc.Driver");
         moConnectionProperties.put("user", "root");
         moConnectionProperties.put("password", "password");
    // load the driver
    try {
    Class.forName("com.mysql.jdbc.Driver");
    //Class.forName("org.gjt.mm.mysql.Driver");
    catch (Exception ex)
    System.err.println("driver Class not found\n" + ex);
    System.exit(-1);
    // connect to database
    try {
    String mSURL = "jdbc:mysql://" + moConnectionProperties.get("host") + ":" +
    moConnectionProperties.get("3306") + "/" + moConnectionProperties.get("BAEKO");
    con = DriverManager.getConnection(mSURL, moConnectionProperties);
    catch (Exception ex)
         System.err.println("can't connect database\n" + ex);
         System.exit(-1);
         return con;
         public void closeConnection()
         try{
              con.close();
         catch(Exception e){;}
    2.LanguageFunctions Class
    package Langpack;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class LanguageFunctions extends Databaseclass
    public LanguageFunctions()
         super();
    LanguageDetails getDetails(String X)
         LanguageDetails objLanguageDetails=null;
         try
         Statement st=con.createStatement();
         ResultSet result=st.executeQuery("Select languageName From LanguageMast Where           languageNo='"+ X +"';");
              objLanguageDetails=new LanguageDetails();
    objLanguageDetails.languageName=result.getString ("languageName");
    objLanguageDetails.languageNo=result.getString("languageNo");
    catch(Exception e)
    return objLanguageDetails;
    LanguageDetails getAllDetails()
    int i=0;
    LanguageDetails vArray[]=null;
    LanguageDetails objLanguageDetails=null;
    try
    Statement st=con.createStatement();
    ResultSet result=st.executeQuery("Select * From LanguageMast;");
    while(result.next())
    objLanguageDetails=new LanguageDetails();          
    objLanguageDetails.languageName=result.getString("languageName");
    objLanguageDetails.languageNo=result.getString("languageNo");
    vArray=objLanguageDetails;
    i++;          
    objLanguageDetails=null;
    catch(Exception e){;}
    return objLanguageDetails;
    boolean saveDetails(Vector X)
    LanguageDetails objLanguageDetails=null;
    Vector objVector=null;
    objVector=X;     
    String vlanguageName;
    String vlanguageNo;
    try
    Statement st=con.createStatement();
    objLanguageDetails=new LanguageDetails();
    objLanguageDetails=(LanguageDetails)objVector.elementAt(0);
    vlanguageName=objLanguageDetails.languageName;
    vlanguageNo=objLanguageDetails.languageNo;
    ResultSet rls=st.executeQuery("SELECT * FROM LanguageMast WHERE languageNo='"+ vlanguageNo +"'");
    if (rls.getRow()==0)
    rls.moveToInsertRow();
    rls.updateString(vlanguageName,"languageName");
    rls.updateString(vlanguageNo,"languageNo");
    rls.insertRow();
    else
    rls.updateString(vlanguageName,"languageName");
    rls.updateRow();     
    return false;               
    catch(Exception e)
    return true;          
    3.LanguageDetailsServlet class
    package Langpack;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class LanguageDetailsServlet extends HttpServlet
    public String vlanguageNo;
    public String vlanguageName;
    PrintWriter pw;
    public void service(HttpServletRequest req, HttpServletResponse res)
    LanguageFunctions objLanguageFunctions=null;     
    LanguageDetails objLanguageDetails=null;
    Vector vect=new Vector();
    try
    vlanguageNo=req.getParameter("txtLanguageNo");
    vlanguageName=req.getParameter("txtLanguageName");     
    objLanguageDetails=new LanguageDetails();
    pw=res.getWriter();
    res.setContentType("text/html");
    pw.println("<html><body>"+vlanguageNo+"</body></html>");
    pw.println("<html><body>"+vlanguageName+"</body></html>");
    objLanguageDetails.setNo(vlanguageNo);
    objLanguageDetails.setName(vlanguageName);
    vect.addElement(objLanguageDetails);
    objLanguageFunctions=new LanguageFunctions();
    objLanguageFunctions.saveDetails(vect);
    catch(Exception e)
    pw.close();
    guys this is code and i am getting error after cliking th submit button on my wepage as:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Servlet execution threw an exception
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.StackOverflowError
    Apache Tomcat/4.1.24
    now tell me the soln of this..i am really fed up of this..plz help me
    also tell me hw to check the connection is done or not...thanks
    waiting for ur suggetions
    Take Care
    Rahul.

  • Tomcat com.mysql.jdbc.NotImplemented error in the first launch

    I created a war in java studio creator2 , export war file and deploy it by TomCat manager, After that ,when I launch a page at the first time , I got the following error
    com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: java.lang.RuntimeException: com.mysql.jdbc.NotImplemented: Feature not implemented
         com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java:601)
         com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:316)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
    If I launch the same page again , this problem does not ocurr and the jsp page work normaly , it can access the database without any problem
    Right now , I am using Tomcat 5.0.28 , js2dk_1.4.2_04,mysql 4.0.16 , SuSe 8.0 , java studio creator 2
    jdbc driver class :org.gjt.mm.mysql.Driver
    url : jdbc:mysql://192.168.100.151/mangomaximo
    I have read many journal in this forums and I have follow the some of the instruction to try many time , but still failed .
    Could anyone help me ?
    Thanks

    Hi,
    See this "Deployment Example: Tomcat" might still helps
    http://developers.sun.com/prodtech/javatools/jscreator/reference/docs/help/deploy/howtodeploy/deploy_tomcat.html
    MJ

  • MYSQL JDBC NoClassDefFoundError: org/aspectj/lang/Signature

    i am trying to connect to a database via java using JDBC i have installed:
    jdk1.5.0_01
    mysql-connector-java-3.1.8-bin-g.jar
    MySQL Server 4.1
    Java works fine, MYSQL works fine from the command prompt but when it comes to testing using this simple java program
    public class JdbcExample1 {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("localhost", "username", "password");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    this compiles fine but when run i get the following error message
    Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at JdbcExample1.main(JdbcExample1.java:10)
    class path is set as .;C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext\mysql-connector-java-3.1.8-bin.java
    any help or input on this error would be appreciated
    thanks in advanced Neil

    Hi, All:
    I just read this thread of discussion and got valueable info to solve my problem in a similar fashion. I'd suggest the last poster, Anil, to re-read the whole thread to correct the possible problems stated.
    I would just like to add my problem/solution scenario to this thread to share my experience. I assume that readers already went through the previous notes in this thread.
    #1. Space in Path:
    I installed
    MySQL DB server in: "C:\Program Files\MySQL\MySQL Server 4.1"
    MySQL JDBC Driver: D:\mysql\mysql-connector-java-3.1.8
    It seems to me that the DB server installed directory is not affected by whether there is a space in path name. The JDBC Driver path, on the other hand, does have the side effect of the space in path name when accessing by the Java client.
    #2. -g in JDBC Driver:
    I have been using the driver mysql-connector-java-3.1.8-bin.jar. However, right before I needed to create my ant build.xml configuration file (more details later), I thought the instruction asked me to use the mysql-connector-java-3.1.8-bin-g.jar (the debug version as kpreiser indicated), and therefore I got the now-well-known "org/aspectj/lang/Signature" error. After I removed that "-g" from the JDBC driver extression in my build.xml file, it then works well. (Great tip, kpreiser.)
    #3. Middlegen with Hibernate:
    My situation is a bit more complicated, but the issue of "org/aspectj/lang/Signature" error was the same (finally resolved in #2). I was trying to use Middlegen to re-generate my Hibernate map files from the data schema. (Hibernate is an open source tool that lets you create JavaBean source file from a Hibernate map file to map to a database table (see http://www.hibernate.org/ for more details.) Since I re-factored my data schema in the database, I needed to re-generate the Hibernate map files (from data schema) so that I can in turn use the map files to re-generate the JavaBean code. I wanted to use the Middlegen tool (see http://www.hibernate.org/98.html for more details) to re-generate the map files from database schema. However, in order to use Middlegen properly, you need to create the ant build.xml file to do that job. So I had to resort to MiddlegenIDE (see http://ultimania.org/middlegenide/ for more details) to help generate that build.xml file. (This is where I had the -g specified for the JDBC driver in the build.xml file that caused the problem.) Once that build.xml file is generated, the use of ant (a Java make tool) with the build.xml file can generate the hibernate map files. From these map files, JavaBean source files can be generated using Hibernate CodeGenerator.hbm2java tool. (There are several other useful tools in Hibernate too to convert the database ddl schema and the JavaBean source file.)
    Obviously, there are other approaches and tools that you can use (XDoclet for instance) for different situations, but I am only providing a high level overview on what you can do to be more productive if you are involved in a large and complicated project with Java/JDBC and ORM (Object/Relational Mapping).
    Item #3 may sound complicated at first, but it's worth the time to learn the tools and concept. Once you are familiar with these tools (Eclipse, Hibernate, Middlegen, Ant, etc.), you will become more productive in responding to the dynamic nature of the high-tech world where changing requirements are the only constant. I hope that these separate tools will become more integrated and easier to use in the future, but for now they do the job well.
    Thanks for the great tips and hope that this helps too.
    - Shuh

  • MySQL /JDBC Question

    I began playing with JDBC a few days ago. I set up a database using mySQL and wrote a simple java program that will connect to it. Works good from the computer that holds the database.
    I try and run the same program from my secondary computer which does not have mySQL or ODBC mySQL drivers, I get com.mysql.jdbc.Driver for an error message. (Trying to access the database on my main computer via ip/databasename)
    My Question is, do you HAVE to have mySQL or Connector/ODBC installed on a computer if you wish to connect to a database on other computer??
    Here's where it prints the error message...
    try
    Class.forName("com.mysql.jdbc.Driver");
    catch (Exception e)
    JOptionPane.showMessageDialog(null, "ERROR = " + e.getMessage());
    I use this as my url..
    private final String url = "jdbc:mysql://122.122.122.122:3306/test123";
         

    Say I want to make a simple web applet that will
    access a database on my computer. The only way my
    vistors to my website will be able to access the
    database via the web applet is by having mySQL JDBC
    driver installed on their computers?yes.
    however.
    you can package up the JDBC driver as part of your jar with your applet so it doesn't require the user to "install" anything. it's just part of your applet.

  • MySQL connection error

    Dear Fellow Java Developers:
    I am a junior java developer and I sincerely apologize for my ignorance. I have searched the archives of this forum for advice and information, and for some reason I am not able to get the results I desire.
    I have the following line in my classpath:
    C:\mysql\java\mysql-connector-java-2.0.14-bin.jar;.
    now when I run the following program which I got of the following url:
    http://www.javacoding.net/articles/technical/java-mysql.html?page=1#contentAnchor
    /* import needed for JDBC access */
    import java.sql.*;
    * MySQL Demo Program
    * this program is just a little demonstration of the usage
    * of MySQL in combination with Java JDBC
    * http://www.javacoding.net
    public class TestMySQL {
    public void test ( String host, String database ) throws Exception {
    /* first, we'll test whether the MySQL driver is installed */
    testDriver ( );
    /* then, we'll get a connection to the database */
    Connection con = getConnection ( host, database );
    /* we create a table */
    executeUpdate ( con, "create table test (id int not null,text varchar(20))" );
    /* we insert some data */
    executeUpdate(con,"insert into test (id,text) values (1,'first entry')");
    executeUpdate(con,"insert into test (id,text) values (2,'second entry')");
    executeUpdate(con,"insert into test (id,text) values (3,'third entry')");
    /* then we'll fetch this data */
    executeQuery ( con, "select * from test" );
    /* and we'll destroy the table ... */
    executeUpdate ( con, "drop table test" );
    /* finally, we close the database */
    con.close ( );
    * Checks whether the MySQL JDBC Driver is installed
    protected void testDriver ( ) throws Exception {
    try {
    Class.forName ( "org.gjt.mm.mysql.Driver" );
    System.out.println ( "MySQL Driver Found" );
    } catch ( java.lang.ClassNotFoundException e ) {
    System.out.println("MySQL JDBC Driver not found ... ");
    throw ( e );
    * Returns a connection to the MySQL database
    protected Connection getConnection ( String host, String database )
    throws Exception {
    String url = "";
    try {
    url = "jdbc:mysql://" + host + "/" + database;
    Connection con = DriverManager.getConnection(url);
    System.out.println("Connection established to " + url + "...");
    return con;
    } catch ( java.sql.SQLException e ) {
    System.out.println("Connection couldn't be established to " + url);
    throw ( e );
    * This method executes an update statement
    * @param con database connection
    * @param sqlStatement SQL DDL or DML statement to execute
    protected void executeUpdate ( Connection con, String sqlStatement )
    throws Exception { 
    try {
    Statement s = con.createStatement ( );
    s.execute ( sqlStatement );
    s.close ( );
    } catch ( SQLException e ) {
    System.out.println ( "Error executing sql statement" );
    throw ( e );
    * This method executes a select statement and displays the result
    * @param con database connection
    * @param sqlStatement SQL SELECT statement to execute
    protected void executeQuery( Connection con, String sqlStatement )
    throws Exception { 
    try {
    Statement s = con.createStatement ( );
    ResultSet rs = s.executeQuery( sqlStatement );
    while ( rs.next ( ) ) {
    String id = ( rs.getObject ("id").toString() );
    String text = ( rs.getObject ("text").toString() );
    System.out.println ( "found record : " + id + " " + text );
    rs.close ( );
    } catch ( SQLException e ) {
    System.out.println ( "Error executing sql statement" );
    throw ( e );
    * This one is used to start the program.
    public static void main ( String args[] ) throws Exception {
    if ( args.length == 2 ) {
    new TestMySQL ( ).test ( args[0], args[1] );
    } else {
    System.out.println ( "usage: java TestMySQL host database" );
    when I compile and run the program, I still get a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    I get the same error when I use the following driver as well
    org.gjt.mm.mysql.Driver
    Does my java program have to be in a certain directory in relation to the mysql directory? All I did at the msql> prompt was to create a database called jtest and typed in
    C:\java TestMySQL localhost jtest
    in order to run the above program.
    Am I overlooking something? Have I forgotten to do something? I am currently using jdk1.3 instead of jdk1.4, is that the problem?? If it is, how do I correct the problem without switching to jdk1.4??
    Any and all help is appreciated, and I sincerely thank all developers who read this post.
    Take care.
    Sincerely;
    Fayyaz

    syedfa,
    I don't know if you have already figured out the problem that you were experiencing, but I was having this same problem, and I finally got it figured out. I was having difficulty on how exactly to set the classpath. I am using Windows XP, and I have seen and tried a lot of different variations. From the command prompt in the directory where the file was saved I finally got your program to compile using:
    java -classpath C:\mysql\mysql-connector-java-2.0.
    14\mysql-connector-java-2.0.14-bin.jar; TestMySQL localhost test
    Of course it would be much easier if the environment variable for this was set so you don't have to type it in everytime at the command prompt, and I finally got that one figured out to. If you are using Windows XP then you can:
    Right click on My Computer and go to Properties.
    Click on Advanced.
    Click on Environment Variables.
    Under System Variables, click on New.
    For the Variable name type: CLASSPATH
    For the Variable Value type: .;C:\mysql\mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar
    In the above variable value, the ".;" before C: isn't a typo. The path that I put in is the path to the MySQL JDBC driver on my computer so it may vary on your computer.
    I think this will also work with Windows 2000.
    I hope this helps if you still need it, maybe it will also help somebody else with the same problem.

  • MySQL JDBC Performance Issues

    Hi, First off, let me admit, im a java newbie. I've been using java for about 6 months now, although im a fast learner, some things still elude me.
    I've searched these forums and google high and low for an answer to my question before signing up and posting here, so i'm kind of at my wits end.
    Let me explain my specs so noone blames lack of power for this issue.
    System specs:
    Linux Cent OS 4 2.6.19 SMP
    JRE 1.6
    MySQL 4.2.2 ICC Compiled Enterprise Edition
    4x HyperThreaded Xeon 1.9Ghz cpus (Displays as 8)
    16GB ECC Double-Parity Double-Buffered Memory. (Rediculous IBM proprietary memory)
    Problem:
    I first wrote this application in PHP as it my stong suit (that should tell you plenty). But the PHP CLI was eating up way to much CPU power/MySQL bandwith to execute this script, and taking way to long, so i started re-writing it in C++, well when my feeble C++ powers failed me, i went to Java. I know more Java then C++ but i picked C first because i thought it would be the fastest. Java, however, is slower then PHP when i write the identical logic, i dont know if i should blame Java or my assumption that i can copy logic from one language to another.
    Here is the details:
    I have 1 MySQL database and 2 Tables im pulling from, This mysql database is optimized by the people from MySQL, so i know its not the DB, Server, or Tables. 1 table (bfpax) has around 45k rows (45000), the second table (bfbdet) has around 100k rows (100000). What this program has to do, its objective, is:
    1. Pull the indexed ID from table 1;
    2. With that ID, pull other data from table 2 and table 1 for each ID;
    3. Compile that data together for each ID
    4. Insert compiled data into a HEAP table for fast access for each ID.
    In PHP (pseudocode):
    SELECT ID FROM bfpax;
    Loop:
    Foreach id pull various data pieces i.e. name, client code, address, zip, etc.
    String format name: "A-GARY/COLE" becomes "Gary/Cole"
    String format hotel: "ACUNMIP" becomes CUNMIP
    Insert all formatted/fixed data into heap table
    End loop.
    In Java (pseudocode):
    SELECT ID FROM cpax;
    Loop:
    Create object with ID as constructor variable (see below for object declaration) and add to an arrayList;
    End Loop;
    Create 6 threads to execute each of the objects methods for data collection/formatting
    Start each thread using inner classes to loop through the object arraylist and execute dedicated methods per thread.
    Thread 1: Pull air data
    Thread 2: Pull destination
    Thread 3: Pull hotel
    Thread 4: Pull gateway
    Thread 5: Pull the rest (price, dates, etc)
    Thread 6: Start executing the update method
    The above kind of failed, so i reduced the complexity by nuking the whole thread idea and now i just have a simple function that loops through the arraylist of objects and executes each method in order.
    Booking Object:
    public class Booking extends ReportingConstants{
        private ArrayList<String> myData = new ArrayList<String>();
        private int myBookNum;
        private static Connection myCon;
        public static int numBookings;
        public int updateCount = 0;
        public boolean isFinished = false;
        public Booking(int booking_number, Connection conn) {
            if (booking_number > 9999) {
                myBookNum = booking_number;
            numBookings++;
            myCon = conn;
            //Run loop to make sure myData has the proper spaces for insert, ensureCapacity didnt work.
            for (int i = 0; i < 15; i++) {
                myData.add("");
            myData.set(_BOOKNUM,String.valueOf(myBookNum));
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 0) {
                System.out.println("Initialized booking number "+myBookNum+" count "+numBookings);
        public void getAir() {
            ResultSet res;
            ArrayList<String> total_air = new ArrayList<String>();
            String airlines = "";
            String query = "SELECT operator_id FROM EDITED.bfbdet WHERE record_type = 'A' AND item_desc LIKE '-%' AND booking_number = "+myBookNum+" AND operator_id IS NOT NULL";
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println("Starting Air: "+query);
            res = MySQL.sqlQuery(query,myCon,5);
            try {
                while(res.next()) {
                    if (res.getString(1).length() > 1) {
                        String id = res.getString(1).substring(0,2);
                        if (!total_air.contains(id)) {
                            airlines += id+",";
                        total_air.add(id);
                res.close();
                MySQL.close();
            } catch (Exception ex) {
                ex.printStackTrace();
            myData.set(_AIR,airlines);
            updateCount++;
        public void getDest() {
            String query = "SELECT booking_code FROM EDITED.bfpax WHERE booking_number = "+myBookNum+" LIMIT 1";
            ResultSet res;
            String isSv ="Y";
            String dest;
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println("Starting Dest: "+query);
            res = MySQL.sqlQuery(query,myCon,1);
            try {
                while (res.next()) {
                    dest = res.getString(1).substring(1,4);
                    if (dest != "FRE") {
                        if (dest == "GYY") {
                            String realDest = res.getString(1).substring(4,2);
                            if (realDest == "GY") {
                                dest = "GYY";
                            } else if (realDest == "MC") {
                                dest = "MCO";
                            } else if (realDest == "FL") {
                                dest = "FLL";
                            } else if (realDest == "IW") {
                                dest = "IWA";
                            } else if (realDest == "PI") {
                                dest = "PIE";
                            } else if (realDest == "LA") {
                                dest = "LAS";
                            } else {
                                dest = "GYY";
                        } else {
                            isSv = "N";
                        myData.set(_DEST,dest);
                        myData.set(_SV,isSv);
                        updateCount++;
                res.close();
                MySQL.close();
            } catch (Exception ex) {
                ex.printStackTrace();
        public void getGateway() {
            String query = "SELECT item_desc FROM EDITED.bfbdet WHERE (booking_number = '"+myBookNum+"' OR booking_number = ' "+myBookNum+"') AND item_desc LIKE '-%' ORDER BY booking_suffix ASC LIMIT 1";
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println("Starting GW: "+query);
            ResultSet res = MySQL.sqlQuery(query,myCon,1);
            String gw;
            try {
                while (res.next()) {
                    gw = res.getString(1).substring(1,3);
                    myData.set(_GW,gw);
                updateCount++;
                res.close();
                MySQL.close();
            } catch (Exception ex) {
                ex.printStackTrace();
        public void getHotel() {
            String query = "SELECT operator_id FROM EDITED.bfbdet WHERE record_type = 'H' AND (booking_number = '"+myBookNum+"' OR booking_number = ' "+myBookNum+"') LIMIT 1";
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println("Starting Hotel: "+query);
            ResultSet res = MySQL.sqlQuery(query,myCon,1);
            String hotel = "";
            try {
                while (res.next()) {
                    hotel = res.getString(1).substring(0,6);
                    if (myData.get(_DEST) == "") {
                        myData.set(_DEST,res.getString(1).substring(0,3));
                        updateCount++;
                myData.set(_HOTEL,hotel);
                updateCount++;
                res.close();
                MySQL.close();
            } catch (Exception ex) {
                ex.printStackTrace();
        public void getRest() {
            String query = "SELECT client_code, passenger1_name, agentid, booked_date, dep_date, total_price, total_received, total_commission, number_pax FROM EDITED.bfpax WHERE booking_number = "+myBookNum+" LIMIT 1";
            if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                System.out.println("Starting Rest: "+query);
            ResultSet res = MySQL.sqlQuery(query,myCon,1);
            try {
                while (res.next()) {
                    myData.set(_AGENCY,res.getString(1));
                    if (res.getString(3) != "null") {
                        myData.set(_AGENT,res.getString(3));
                    } else {
                        myData.set(_AGENT,"");
                    myData.set(_PAXNAME,res.getString(2).replace("'",""));
                    myData.set(_BKDATE,String.valueOf(res.getDate(4)));
                    myData.set(_DEPDATE,String.valueOf(res.getDate(5)));
                    myData.set(_TPRICE,String.valueOf(res.getDouble(6)));
                    myData.set(_TRECV,String.valueOf(res.getDouble(7)));
                    myData.set(_TCOM,String.valueOf(res.getDouble(8)));
                    myData.set(_NUMPAX,String.valueOf(res.getInt(9)).trim());
                    //System.out.println("NUMPAX: |"+myData.get(_NUMPAX)+"|");
                updateCount++;
                res.close();
                MySQL.close();
            } catch(Exception ex) {
                ex.printStackTrace();
        public void storeData() {
            if (!isFinished) {
                String query = "INSERT INTO "+tmpTable+" (`booking_number`, `destination`, `gateway`, `airline`, `hotel`, `agency`, `agent`, `booked_date`, `dep_date`, `total_price`, `total_received`, `total_commission`, `number_pax`, `passenger_name`, `is_skyvalue`) VALUES('"+myData.get(0)+"','"+myData.get(1)+"','"+myData.get(2)+"','"+myData.get(3)+"','"+myData.get(4)+"','"+myData.get(5)+"','"+myData.get(6)+"','"+myData.get(7)+"','"+myData.get(8)+"','"+myData.get(9)+"','"+myData.get(10)+"','"+myData.get(11)+"','"+myData.get(12)+"','"+myData.get(13)+"','"+myData.get(14)+"')";
                if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
                    System.out.println(query);
                MySQL.sqlExec(query,myCon);
                isFinished = true;
                if (Integer.valueOf(_ARGS[_DEBUG][1]) > 0) {
                    System.out.println("Booking number "+myBookNum+" is finished!");
            } else {
                //System.out.println("Not fully populated!");
    }Please dont laugh too hard heh, i know my code is sloppy and probably not optimized at all, i dont pretend to be a hardcore java guy, but i would love to learn. Im also posting below my static MySQL class so you can see what happens when i call sqlQuery();
    public abstract class MySQL {
        private static ResultSet res;
        private static Statement stmt;
        public static ResultSet sqlQuery(String query,Connection con, int limit) {
            try {
                stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                stmt.setFetchSize(limit);
                res = stmt.executeQuery(query);
            } catch(Exception ex) {
                ex.printStackTrace();
                res = null;
                System.out.println("Cant Query!: "+query);
            return res;
        public static void sqlExec(String query,Connection con) {
            Statement stmt;
            try {
                stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                stmt.executeUpdate(query);
                stmt.close();
            } catch(Exception ex) {
                ex.printStackTrace();
                System.out.println("Cant Query!: "+query);
        public static void close() {
            try {
                stmt.close();
                res.close();
            } catch (Exception ex) {
                ex.printStackTrace();
    }If you notice, i require the connection to be passed when executing a query, i do this because even if i made a static connection state in the MySQL class, for some reason, it still gets duplicated every time its called. This way, i create 1 connection with the calling static main class, and pass that same conn back and forth through the whole script. I know in PHP this is the best way to do it, in Java it may require many different connections.
    By the way, this is an update that runs once per hour, it does not have to worry about users or anything like that, it gets executed by cron on the hour.
    PHP does this job of updating about 40000 entries in 9-12 minutes. for an average of 0.0135 seconds per entry, Java rolls around at 0.06 seconds per query, 6x slower, this puts execution time at about 40 minutes, obviously this is an issue if its supposed to run every hour. The java app does not tax the system, on top/htop it does not even make it to the first page so its not resources, ive looked at the verbose gc info, and i didnt see anything to clue me in there either.
    I'm sure this is a simple error and my lack of knowledge with Java is what's holding me back, but if i cant figure this out ill have to go back to struggling with C++.
    Thanks in advance, and im sorry for the horribly long post.
    Thanks,
    Dave

    I didnt want to include this in the original post, so here is where my main is located:
    public class ReportingUpdate extends ReportingConstants {
        private ArrayList bookings;
        private static String[] argList;
        private static ArrayList<String> provArg = new ArrayList<String>();
        public ArrayList notDone = new ArrayList();
        private static Connection conn;
        public int bookingsUpdated;
        public static boolean isUpdating = false;
        private static int _ERRORS = 0;
        public static ArrayList doneBookings = new ArrayList();
        public static void main(String[] args) {
            if (args.length > 0) {
                if (args[0].contains("-help")) {
                    printHelp();
                } else {
                    setupArgs();
                    argList = args;
                    parseArgs();
            if (_ERRORS == 0) {
                new ReportingUpdate().go();
            } else {
                return;
        private static void parseArgs() {
            for (String s : argList) {
                if (s.indexOf("-") != 0) {
                    printHelp();
                    break;
                if (s.length() > 2) {
                    provArg.add(s.substring(1,2));
                } else {
                    printHelp();
                    break;
            for (int i = 0; i < _ARGS.length; i++) {
                if (provArg.contains(_ARGS[0])) {
    int pos = provArg.indexOf(_ARGS[i][0]);
    ReportingConstants._ARGS[i][1] = argList[pos].substring(2);
    //Commented out argument testing loop.
    /*for (String[] s : _ARGS) {
    System.out.println("Arg: "+s[0]+" Value: "+s[1]);
    _ERRORS++;*/
    public static void printHelp() {
    System.out.println("\nReporting Update 1.1 (2007 February 1, compiled Feb 19 2007 11:12:24)");
    System.out.println("");
    System.out.println("Usage: java -jar /path/to/ReportingUpdate.jar [arguments]");
    System.out.println("");
    System.out.println("Arguments:");
    System.out.println(" -d<level>\tDebug Level: 0-No Output(Default), 1-Start and finish output, 2-Functional Output(Lots of output)");
    System.out.println(" -l<limit>\tBooking Limit. How many bookings will be updated, only use this for testing.");
    System.out.println(" -a<0,1> \tBool choice to run the air update function, speed testing option. (0-0ff,1-On)\n \t\tIf this is not set, on is assumed");
    System.out.println(" -e<0,1> \tSame as above, but for destination.");
    System.out.println(" -g<0,1> \tSame as above, but for gateway.");
    System.out.println(" -h<0,1> \tSame as above, but for hotel.");
    System.out.println(" -r<0,1> \tSame as above, but for agency,agent,price & dates.");
    System.out.println(" -u<0,1> \tSame as above, but for each bookings actual insert into the db.");
    System.out.println("");
    System.out.println("Example: java -jar /path/to/ReportingUpdate.jar -d1 -l500 -a0 -d0 -u0");
    System.out.println("Run the reportingupdate with debug level 1, limit 500 bookings and do not run the air, destination or insert functions.\n");
    _ERRORS++;
    public void go() {
    String limitString;
    if (Integer.valueOf(_ARGS[_LIMIT][1]) > 0) {
    limitString = "LIMIT "+_ARGS[_LIMIT][1];
    } else {
    limitString = "";
    bookings = new ArrayList();
    ResultSet res;
    connect();
    res = MySQL.sqlQuery("SELECT booking_number FROM EDITED.bfpax WHERE booking_number IS NOT NULL "+limitString,conn,Integer.valueOf(_ARGS[_LIMIT][1]));
    try {
    int i = 0;
    while (res.next()) {
    String booking = res.getString("booking_number");
    booking = booking.trim();
    if (booking.length() > 1) {
    //System.out.println("Reading booking "+booking);
    bookings.add(new Booking(Integer.valueOf(booking),conn));
    i = 1;
    startTheFire();
    } catch(Exception ex) {
    ex.printStackTrace();
    private void startTheFire() {
    /*Thread a = new Thread(new DoAir());
    Thread b = new Thread(new DoDest());
    Thread c = new Thread(new DoGW());
    Thread d = new Thread(new DoHotel());
    Thread e = new Thread(new DoRest());
    Thread f = new Thread(new DoUpdate());
    a.setName("Air");
    a.start();
    b.setName("Dest");
    b.start();
    c.setName("GW");
    c.start();
    d.setName("Hotel");
    d.start();
    e.setName("Rest");
    e.start();
    f.setName("Update");
    f.start();
    try {
    f.sleep(20000);
    } catch (Exception ex) {
    ex.printStackTrace();
    Iterator it = bookings.iterator();
    while (it.hasNext()) {
    Booking b = (Booking) it.next();
    if (Integer.valueOf(_ARGS[_AIRARG][1]) > 0) {
    b.getAir();
    if (Integer.valueOf(_ARGS[_DESTARG][1]) > 0) {
    b.getDest();
    if (Integer.valueOf(_ARGS[_GWARG][1]) > 0) {
    b.getGateway();
    if (Integer.valueOf(_ARGS[_HOTELARG][1]) > 0) {
    b.getHotel();
    if (Integer.valueOf(_ARGS[_RESTARG][1]) > 0) {
    b.getRest();
    if (Integer.valueOf(_ARGS[_UPDATEARG][1]) > 0) {
    b.storeData();
    class DoAir implements Runnable {
    public void run() {
    Iterator it = bookings.iterator();
    while(it.hasNext()) {
    Booking tempBooking = (Booking) it.next();
    tempBooking.getAir();
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("Air is done!");
    class DoDest implements Runnable {
    public void run() {
    Iterator it = bookings.iterator();
    while(it.hasNext()) {
    Booking tempBooking = (Booking) it.next();
    tempBooking.getDest();
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("Dest is done!");
    class DoGW implements Runnable {
    public void run() {
    Iterator it = bookings.iterator();
    while(it.hasNext()) {
    Booking tempBooking = (Booking) it.next();
    tempBooking.getGateway();
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("Gateway is done!");
    class DoHotel implements Runnable {
    public void run() {
    Iterator it = bookings.iterator();
    while(it.hasNext()) {
    Booking tempBooking = (Booking) it.next();
    tempBooking.getHotel();
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("Hotel is done!");
    class DoRest implements Runnable {
    public void run() {
    Iterator it = bookings.iterator();
    while(it.hasNext()) {
    Booking tempBooking = (Booking) it.next();
    tempBooking.getRest();
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("The Rest is done!");
    class DoUpdate implements Runnable {
    public void run() {
    while (bookingsUpdated <= Booking.numBookings) {
    if (doneBookings.size() > 0) {
    isUpdating = true;
    Iterator it = doneBookings.iterator();
    while (it.hasNext()) {
    Booking b = (Booking) it.next();
    b.storeData();
    bookingsUpdated++;
    it.remove();
    isUpdating = false;
    if (Integer.valueOf(_ARGS[_DEBUG][1]) > 1) {
    System.out.println("Update is done!");
    private void connect() {
    try {
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection(_URL,_USER,_PASS);
    } catch(Exception ex) {
    System.out.println("Cannot Connect to: "+_URL);
    ex.printStackTrace();
    createTempTable();
    private void createTempTable() {
    String create_query = "CREATE TABLE IF NOT EXISTS `"+tmpTable+"` (`ID` INT( 5 ) NOT NULL AUTO_INCREMENT ,`booking_number` INT( 6 ) NULL ,`destination` CHAR( 3 ) NULL ,`gateway` CHAR( 3 ) NULL ,`airline` VARCHAR( 15 ) NULL ,`hotel` CHAR( 6 ) NULL ,`agency` VARCHAR( 15 ) NULL ,`agent` VARCHAR( 20 ) NULL ,`booked_date` VARCHAR( 10 ) NULL ,`dep_date` VARCHAR( 10 ) NULL ,`total_price` VARCHAR( 10 ) NULL ,`total_received` VARCHAR( 10 ) NULL ,`total_commission` VARCHAR( 10 ) NULL ,`number_pax` INT( 5 ) NULL ,`passenger_name` VARCHAR( 50 ) NULL,`is_skyvalue` CHAR( 1 ) NULL,PRIMARY KEY ( `ID` ),INDEX ( `booking_number` ),INDEX ( `agency` ) ) TYPE = memory;";
    String trunc = "TRUNCATE TABLE `"+tmpTable+"`";
    MySQL.sqlExec(create_query,conn);
    MySQL.sqlExec(trunc,conn);

Maybe you are looking for