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.

Similar Messages

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

  • Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

    Hi,
    At the moment I'm trying to get an example working. The error message I get is:
    Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'"
    The example I tried is http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html.
    Configuration:
    Wampserver 2.0 (Apache, MySQL, PHP for Windows XP), Tomcat 6.0 and jdk1.6.0_03.
    The following files are installed in %CATALINA_HOME%/webabbs/
    - Dbtest/test.jsp
    - Dbtest/WEB-INF/web.xml
    - Dbtest/WEB-INF/lib/standard.jar
    - Dbtest/WEB-INF/lib/tomcat-dbcp.jar
    - Dbtest/WEB-INF/lib/jstl.jar
    Tia,
    Abel.

    Hi,
    I added the jar file containing the requested class to my lib directory. So the current contents of that directory is:
    The following files are installed in %CATALINA_HOME%/webabbs/
    - Dbtest/test.jsp
    - Dbtest/WEB-INF/web.xml
    - Dbtest/WEB-INF/lib/standard.jar
    - Dbtest/WEB-INF/lib/tomcat-dbcp.jar
    - Dbtest/WEB-INF/lib/jstl.jar
    - Dbtest/WEB-INF/lib/mysql-connector-java-5.1.5-bin.jar
    More importantly, I started my Wamp server.
    The example works as it should have. Thanks for the feedback.
    Abel

  • No suitable driver with com.mysql.jdbc.Driver

    Ok. here's the issue. I have a windows box. (first problem) but let's pretend that it's ok. :) I installed Tomcat 4.1 installed J2SDK1.4.0
    start serving pages GREAT!. I have Mysql working perfectly with PHP on this system. I JUST want to connect with JDBC :)
    I've downloaded the MySQL Jdbc Connector/J 3.08 stable installed the .jar file in the $JAVA_HOME/jre/lib/ext as per the README
    Now granted I am a little new to JSP. but I have checked over this again and again. used different code. connected as many ways as I can think of and I still get the same result.
    Database Error :
    No suitable driver
    Please Try Some Other Time
    So I figure it's a MYSQL issue. no I also went thru and did the Microsot connection to MS SQL 2000 with the same result.
    Here's where the drivers are (tried using the other method for installing the MySQL connector as well, and my class path
    Y:\j2sdk1.4.0\com\mysql\jdbc\Driver.class
    com.mysql.jdbc.Driver.class
    Y:\j2sdk1.4.0\org\gjt\mm\mysql\Driver.class
    org.gjt.mm.mysql.Driver.class
    My classpath is:
    .;F:\j2sdk1.4.0\;F:\j2sdk1.4.0\bin\;F:\j2sdk1.4.0\lib\;F:\j2sdk1.4.0\lib\classes\
    [ Here's The Enviorment]
    Windows 2000 5.00.2195 SP3
    MS SQL 2K SP3
    Apache Tomcat/4.1.27
    j2sdk1.4.0
    MySql 3.23.57-nt
    mysql Jdbc Connector/J 3.08 stable
    <!-- mysql.jsp BEGIN-->
    <%@ page import="java.sql.*" %>
    <%
    Connection conn;
    ResultSet results;
    try      {
         String jdbc_driver = "com.mysql.jdbc.Driver";
         System.out.println("jdbc_driver = " + jdbc_driver);
         Class.forName(jdbc_driver).newInstance();
         catch (ClassNotFoundException cnfe)
         System.out.println(cnfe.getMessage());
    try      {
         String url = "jdbc:mysql://localhost:3306/javatest?username=root,password=****"; // pass hidden
         conn = DriverManager.getConnection(url);
         System.out.println("connected to mySql DataBase");
         Statement stmt = conn.createStatement();
         Statement smt=conn.createStatement();
         results=smt.executeQuery("select * from testdata");
              while(results.next())
                   %>
                   <%= results.getString("foo")%>
                   <%= results.getString("bar")%>
                   <%= results.getString("id")%>
                   <%
              results.close();
              conn.close();
         catch(Exception exp)
         %>
              <H3>Database Error : </H3><B><%= exp.getMessage() %></B><H3>Please Try Some Other Time</H3>
         <%
    %>
    <!-- mysql.jsp end -->
    BTW i aslo tried connecting to MicrosoftSQL 2K
    <!-- microsoft.jsp Begin -->
    <%@ page import="java.sql.*" %>
    <%
    Connection conn;
    ResultSet results;
    try      {
         String jdbc_driver = "sun.jdbc.odbc.JdbcObdcDriver";
         System.out.println("jdbc_driver = " + jdbc_driver);
         Class.forName(jdbc_driver).newInstance();
         catch (ClassNotFoundException cnfe)
         System.out.println(cnfe.getMessage());
    try      {
         String url = "jdbc:odbc:contacts";
         String username = "javauser";
         String pw = "javauser";
         conn = DriverManager.getConnection(url, username, pw);
         System.out.println("connected to Msoft DataBase");
         Statement stmt = conn.createStatement();
         Statement smt=conn.createStatement();
         results=smt.executeQuery("select * from contacts");
              while(results.next())
                   %>
                   <%= results.getString("name")%><br>
                   <%
              results.close();
              conn.close();
         catch(Exception exp)
         %>
              <H3>Database Error : </H3><B><%= exp.getMessage() %></B><H3>Please Try Some Other Time</H3>
         <%
    %>
    <!-- microsoft.jsp end -->
    got the exact same results.
    Just to show you mysql is Good. with localhost.
    mysql -u root -h localhost -p
    mysql> use javatest
    Database changed
    mysql> select * from testdata;
    | id | foo | bar |
    | 1 | hello | 12345 |
    1 row in set (0.00 sec)
    mysql>

    Nope, it's not a MySQL issue.
    I'd recommend NOT putting the JDBC JAR file (or any others, except Sun-sanctioned extensions) in JAVA_HOME/jre/lib/ext.
    JDBC JARs belong in TOMCAT_HOME/common/lib or in the WEB-INF/lib directory for your particular app. If you put them in the former, all apps running under Tomcat can have access to them. If you put them in the latter, only your app can see them.
    After you've done that, do some reading about JNDI data sources under Tomcat:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    That way you can get that connection code out of your JSPs and into the web.xml and <Context>, where it belongs. You'll be able to change data sources without rewriting your pages.
    Good luck - MOD

  • Com.mysql.jdbc.driver and jdbc:odbc bridge driver

    Hi All,
    I want to update mysql database from data in hashtable. My application already uses JDBC:OBDC bridge driver for retrieving data from excel sheet and putting in hashtable.
    For connecting to mysql i need to use com.mysql.jdbc.driver too in the same code.
    How to do that?
    my code uses.
    Read(String strFilePath,String strFileName)
               filepath = strFilePath;
               filename = strFileName;
                strDriver= "jdbc:odbc:Driver={MicroSoft Excel Driver (*.xls)}";Thanks

    Please stay with one thread:
    http://forum.java.sun.com/thread.jspa?threadID=5145466&tstart=0
    Please don't cross-post this way.

  • Help with com.mysql.jdbc.Driver

    Hi all
    I am new to working with java. I am working off of my laptop (pc -vista) and
    am trying to connect to a database on a server I have, mac osx 10.x.
    First question: I would install com.mysql.jdbc.Driver on the same server as
    the MySql server correct?
    Second and more important question: I have multiple pages
    printed out on installing this driver but I just cannot follow it. I am not
    very good in terminal(mac) and the install seems terminal based.
    Can someone please try to explain to me in laymen terms what needs to
    be done?
    thanks alot
    Marcus

    marcusam wrote:
    sorry for my lack of knowledge
    client code = all on one machine?No, client code = the code you use to access your DB server.
    >
    I wanted to access a database that was on a totally different machine, with a java application.
    is this not very doable - or realistic?
    It's completely doable.
    i found enviroment variables for CLASSPATH that are pointing inside 'jre1.6.0_07'
    but i also have 'jdk1.6.0_07' - should the development kit be the one i use? - sorry
    back to original question - so would i just move the .jar file into
    \jre1.6.0_02\lib\ext\ or something of that sort
    thanks alot
    MarcusYes, you can move the jar into the ext directory if you wish. How are you running your java application? What are you typing/clicking on?

  • Help! JSP w/ struts can't find Class.forName("com.mysql.jdbc.Driver")

    I think this is just a directory structure issue but I can't figure it out. I am writing a JSP / Struts / MYSQL web application which uses the mysql JDBC connector. The connector (mysql-connector-java-5.1.6-bin.jar) is in the referenced libraries. If I write the line of code:
    Class.forName("com.mysql.jdbc.Driver");
    To load up the driver, it works in JSP files in the folder /projectname/webroot/web-inf just fine and I can go on to execute MySQL queries. However, I need to load up the driver in an action (.java action) with the directory structure /projectname/src/action and it throws the exception "class not found", I believe, it can no longer seem to get to the driver. Can anyone tell me how to resolve this problem?
    Thanks in advance, I hope this is the correct place (I have done my best to find the right one).
    Edited by: Arkanin on Apr 24, 2008 4:39 PM

    Arkanin wrote:
    I think this is just a directory structure issue but I can't figure it out. I am writing a JSP / Struts / MYSQL web application which uses the mysql JDBC connector. The connector (mysql-connector-java-5.1.6-bin.jar) is in the referenced libraries. Nope, it's not. I don't know what "referenced libraries" means. It has to be in CLASSPATH, and that isn't an environment variable.
    If I write the line of code:
    Class.forName("com.mysql.jdbc.Driver"); No, wrong.
    The JAR file for the Driver class might go in the WEB-INF/lib of your web app. If you're using Tomcat 5.5.26, put it in common/lib.
    %

  • 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

  • [Sun Studio 11] Classpath issue: com.mysql.jdbc.Driver not found

    Greetings !!
    I'm trying in an Applet to connect to a mysql database but the Applet fails everytime.
    It works perfectly in console environnement with the same javaconnector.
    I read this:
    +Classpath. Specifies the path to the classes that the IDE uses. By default the IDE uses its internal class path, which includes all mounted filesystems and various directories in the IDE's installation and user directories. The IDE ignores your CLASSPATH environment variable. Click the ellipsis button to display a property editor in which you can change the class path settings.+
    So my CLASSPATH environnement variable is passed by (as I redoubted) but I don't know why even specifying classpathes in Options/Building/Compiler Types/internal compilations/expert/class path the I got the same behaviour from the Applet... is there another way to specify that this Driver* is located in */usr/share/java/mysql-connector-java-5.1.7-bin.jar* ??
    I also added the jar files in Options/IDE configuration/System/File System settings/java librairies but same behaviour again... but when compiling the output windows indicates that it has finished jdbc... that's all, the Applet still can't open a connexion with the mysql server...
    Can somebody could explain to me how set up the IDE to use this javaconnector in order to connect to the mysql database ?
    Thank you for your time...
    Hurukan

    This forum is about the tools provided with Sun Studio, the development system for C, C++, and Fortran programming.
    Since your question is about Java, you are more likely to get a helpful answer in a Java forum. Go to forums.sun.com, and look under the Java heading.
    Or if your question is about Netbeans, try a forum at netbeans.org

  • Java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    hi All,
    i am facing the above error and stack parsing is as follows:
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at imgstore.<init>(imgstore.java:21)
    at imgstore.main(imgstore.java:92)
    CLASSPATH is "C:\JDK1.5\bin"
    I have already downloaded "mysql-connector-java-5.0.5-bin.jar" and placed the "C:\JDK1.5\jre\lib\ext\" .
    Still this problem persist.........plz guide me for the same.........
    thanks in advance......

    What is <classname>? Is that the "ClassToRun" from my example?
    If so, add the path to the "root" of the package hierarchy where your class can be found.
    For example:
    Your class is in C:\Bogus\Bogus1\com\mine\MyClass.class
    And its package is com.mine
    Then your command looks like this:
    java -cp "C:\full\path\to\jarfile\mysql-connector-java-5.0.5-bin.jar;C:\Bogus\Bogus1" com.mine.MyClass
    Or your class is in C:\Bogus\Bogus1\myjarfile.jar
    Then your command looks like this:
    java -cp "C:\full\path\to\jarfile\mysql-connector-java-5.0.5-bin.jar;C:\Bogus\Bogus1\myjarfile.jar" com.mine.MyClassEdit. Added jar info

  • Java.lang.class not found exception: com.mysql.jdbc.Driver

    Hi everyone,
    I am using Jdk 1.5.0 , Connector/J 3.1 , Mysql 4.1.8 .
    When i try to connect to mysql i got the subject mentioned error
    i had alredy copied mysql-connector-java-3.1.8-bin-g.jar full path in my class path , butstill the same error is coming.
    can any one suggest me the solution for this.
    thanks in Advance.
    bye

    No, the "-g" version just means it has the debug flag turned on when they compile it.
    Your problem is CLASSPATH and how to set it properly.
    Use the -classpath option on java.exe when you run. Read the javadocs on the tools to find out how.
    %

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

  • IDM 8.0 would not pick up MySQL jdbc driver.

    I am trying to create database table using "create new resources" in IDM.
    With orcale, I have no issue. I copy a jdbc driver to C:\idm8\WEB-INF\lib and rename it
    oraclejdbc.jar.
    However, after I copyed mysql-connector-java-5.1.5-bin.jar ( which works with netbean and MySQL server on
    my PC) into the same C:\idm8\WEB-INF\lib directory ( and i tried rename it mysqljdbc.jar too),
    Database Type: MySQL
    JDBC Driver: com.mysql.jdbc.Driver
    JDBC URL TEmplate: jdbc:mysql://localhost:3306/test
    Host:     localhost
    TCP Port: 3306
    Database: test
    I got an error:
    XPRESS <invoke> exception:
    Can't call method getTableData on class com.waveset.ui.web.resources.wizard.DBTableUtil
    ==> com.waveset.util.WavesetException: ==> java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test
    Then I tried the case where I replace localhost with IP Address and th ecase I use Fully qulified
    PC name, I got the same error.
    I know that the driver works because it is being used in NetBeans6.1
    I also tried mysql-connector-java-5.1.6-bin.jar with the same results.
    Does anyone have any ideas?
    Thanks!

    Could your issue be with this line here:
    JDBC URL Template: jdbc:mysql://localhost:3306/testI believe it should be something like this: (As chapo pointed out)
    JDBC URL template: jdbc:mysql://%h:%p/%dThe template is exactly that, a template.. The values are filled in by the next three entries

  • JDBC Driver error when working in command prompt.

    I have a swing program that connects to MySql Database. When run within the Netbeans IDE, there are no errors. But when I run through the command prompt, I get the User Interface screen but does not connect to the database. I have also added the "mysql-connector-java-5.1.6-bin.jar" file in the jdk folder.
    The error I get is "com.mysql.jdbc.Driver" which is the driver I have been using in Netbeans. How do I get over this problem?

    The error I get is "com.mysql.jdbc.Driver" which is the driver I have been using in Netbeans. How do I get over this problem?1. Fix your GUI so it reports the problem, rather than relying on command line output.
    2. Fix your class path which doesn't have the driver jar.
    3. There is a JDBC forum.

Maybe you are looking for