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

Similar Messages

  • 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.

  • 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 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.

  • Mysql-jdbc applet connection issue

    I am developing a user interface for a mysql database. I am able to successfully access the db and execute queries through a java APPLICATION.
    I need to do the same (access the db (mysql)) through a java APPLET. When I compile the applet it complies fine. When I try to run the applet I'm getting the following error message:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    I tied running the applet using appletviewer and through a web browser, same result. I can run the application from the same command prompt it works fine.
    Please help.
    Relevant info:
    OS: Linux, Fedora4
    Classpath: export set CLASSPATH=/home/xyz/Java/mysql-connector-java-5.0.5/:$CLASSPATH;
    JDK: PATH=/usr/java/jdk1.6.0/bin
    Program:
    import java.sql.*;
    public class b extends java.applet.Applet
         int y = 0;
    public void paint(java.awt.Graphics g)
              y = y + 10;
    Connection conn = null;
    String driver = "com.mysql.jdbc.Driver";     
    String url = "jdbc:mysql://localhost:3306/testdb?user=usr1234&password=xyzxyz";
    try {
         Class.forName(driver).newInstance();
         conn = DriverManager.getConnection(url);
         System.out.println("Connected to the database.");
         System.out.println(" ");
         //*********BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
                   try{
                        Statement st = conn.createStatement();
                        ResultSet res = st.executeQuery("SELECT * FROM table1");
                        System.out.println("Name: " + "\t" + "Age: ");
                        while (res.next()) {
                             String s = res.getString("name");
                             int i = res.getInt("age");
                             System.out.println(s + "\t" + i);
                   catch (SQLException s){
              y = y + 20;
    g.drawString("******* s: "+s,50,y);
         //*********END OF BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
         conn.close();
         System.out.println("Disconnected from database");
         }      catch (Exception e) {
              y = y + 20;
    g.drawString("******* e: "+e,50,y);
                   e.printStackTrace();
    Thanks for the help in advance.
    --Mat                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    First, accessing a database from an applet is a horrendous idea.
    Having said that, did you add the mysql jar to the applet tag in the html page (in the archive property)?

  • Connect Forms to MySQL JDBC

    Hi,
    I need help connecting to a MySQL db through oracle reports using a jdbc connection.
    I have downloaded the MySQL JDBC driver:mysql-connector-java-3.0.17-ga-bin.jar.
    I can succesfully use it to connect if I write a simple java program. So I know the driver works.
    I have set it in my classpath & edited the jdbcpds.conf file by adding the following:
    <driver name = "mysql-merant"
    sourceDatabase = "other"
    subProtocol = "mysql"
    connectString = "mainProtocol:subProtocol://databaseName"
    class = "com.mysql.jdbc.Driver"
    connection = "oracle.reports.plugin.datasource.jdbcpds.JDBCConnectionHandling">
    </driver>
    When I try to connect, I get the following error, ERR 62002 failed to connect to the data source.
    What do I have to do to connect? Is there a way to directly give the connect string?
    I can connect to an oracle DB using a the Oracle drivers no problem, why does forms not accept the MySQL driver? What can I do to make this work?
    Any help would be appreciated.
    Michael Baran
    [email protected]

    With Reports 9i the mysql-connector-java doesn´t work for that. You don´t have to edit the jdbcpds.conf. mysql-merant doesn´t exist. Just download MyODBC conector and then stand up your database in your DSN system. Use the wizard to make a report, then use JDBC Query and using jdbc-odbc driver, fill the fields
    then you have connected MySQL
    very easy.
    I hope this help you

  • 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.

  • MySQL -- JDBC Connection help !!!

    Hi everybody...Well I have MySQL Server and Java, I get the JDBC and tried this:
    import java.sql.*;
    public class JdbcE {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "pass");
    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) {}
    And with that code all works fine...but when I change the Host from LOCALHOST to [ROUTER IP] like this:
    con = DriverManager.getConnection("jdbc:mysql://182.185.145.12/test", "user", "pass");
    I got this exception:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know how to solve it...
    I have a 2wire 1700HG router, maybe it would be a problem of the firewall can anyone help me to solve this problem??

    Well I sorry...I am very new in this kind of things...I just know that I have a 2wire 1700HG, I have installed MySQL Server, Java and mysql-connector-java...
    When I try this in the connection statement:
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "test");
    Everything works fine...but when I try this to connect from a remote PC
    con = DriverManager.getConnection("jdbc:mysql://189.145.185.182/test", "user", "test");
    This error comes out on screen:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know what can I do :S please help!! :D

  • 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.

  • Why my MySQL JDBC Connect fail??

    Dear friends:
    I have following code:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class JdbcExample2 {
      public static void main(String args[]) {
        Connection con = null;
        try {
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          //jdbc:mysql://host_name:port/dbname
    //     con = DriverManager.getConnection("jdbc:MySQL:///test","admin", "admin");
          con = DriverManager.getConnection("jdbc:MySQL://localhost:3306/test","admin", "admin");
          if(!con.isClosed())
            System.out.println("Successfully connected to " +
              "MySQL server using TCP/IP...");
        } catch(Exception e) {
          System.err.println("Exception: " + e.getMessage());
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }But when I run , I got following error:
    Exception: com.mysql.jdbc.Driver
    My question is:
    [1]. when I connect to MySQL Server through mySQL Client, I got
    Enter password: *****
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 18 to server version: 4.1.21-community-nt
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql>
    how Can I determine MySQL Server name?? I forgot when I install, maybe MySQL is my SQL Server name
    [2]. Do I need to creat a user DSN name or System DSN name for MySQL Server?? which one is best??
    How to do it??
    [3]. How to make above simple JDBC program runnable??
    Thanks
    sunny
    Message was edited by:
    sunnymanman

    Thanks, see new errors:
    C:\Project\java>java Jdbc11
    Copyright 2004, R.G.Baldwin
    java.sql.SQLException: Access denied for user 'admin'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:868)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3340)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1238)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2743)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at Jdbc11.main(Jdbc11.java:23)
    C:\Project\java>
    any idea??
    here Jdbc11.java:23 is:
    Connection con = DriverManager.getConnection(
    url,"admin", "YES");
    my userID/Password = admin/admin;
    sunny
    Message was edited by:
    sunnymanman

  • Error trying to connect via jdbc

    I'm trying to connect via jdbc driver from a java application to a remote db. The code is quite simple
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@dbhost:orcl", "user", "password");
    in my CLASSPATH I have the ojdbc14.jar file
    When I run this program I get the following error:
    Exception in thread "main" java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
    at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:366
    8)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:353)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:551)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at Test.main(Test.java:12)
    Please be aware of the following facts:
    1) sqlplus from the same machine has no problem connecting to the db
    2) there is no firewall or router between the client and the server
    3) As host name I've tried the fqdn (resolved by the DNS), a name I've set up in /etc/hosts, the mere IP address
    4) Checking with tcpdump, I've verified that NO network packet actually leaves the client, so the problem completely lies there.
    Has anyone some good idea why this happens?

    Make sure you are providing correct hostname and listener port number

  • 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.)

Maybe you are looking for

  • Macbook cpu problem extreme frequent slowdown and subs performance problems

    Hello Since summer 2007 we have been experiencing speed problems with one of our Macs a Macbook bought in 2006. Initially we thought it was just because we were asking too much of the computer. But unfortunately this is not the case. What happens is

  • HP Color Laserjet 4700 and HP Designjet 5000PS

    I've been working for 4 days trying to get these 2 printers to work in Snow Leopard to no avail. I've Reset, Reinstalled several times. The 4700 will never install and Designjet installs, but will never communicate and print. I also have a HP Laserje

  • Is there a way to keep the Nano from auto shutting off?

    This is probably a weird question because it doesn't really involve a problem per se. I am a drummer in a band. I am using my iPod 1 GB Nano to play an intro during our live shows and also play segways between songs because it is more reliable than a

  • Is it really your video card that's the problem?.

    Bought a DC/2.3 G5 to run Aperture, upgraded to 1.1 and everything became slow, got a 7800GT, not a huge improvement. Upgraded to version 1.1.1 with some improvement, now at least it's usable. Got a new MBP 17in with 2Gb ram and a fast(7.2k) disk, sp

  • Program Won't Start Up

    a few days ago i went to start a program from my dock and accidently hit my limewire program, which i didn't want to start. the icon began to bounce so i right clicked on it and hit 'force quit'. the program didn't start so i thought everything was o