JDBC MySQL connector

I my program was working perfectly but for some reason I turned on the computer and I started receiving an error message when I began running it. The error message has to deal with loading the jdbc.driver so I can access my MySQL database..
Class.forName("com.mysql.jdbc.Driver");The driver is located in my C:j2sdk1.4.2_08\jre\lib\ext directory.
This has worked perfectly for the last year without any problems all of a sudden I am receiving the following error due to the preceding java code line. What is the root of the problem?
java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at ClubhousesPanel.ReadSearchListBrd(KL3.java:13490)
at ClubhousesPanel.preloadClasses(KL3.java:13466)
at ClubhousesPanel.<init>(KL3.java:201)
at ClubhousesFrame.<init>(KL3.java:30)
at KL3.main(KL3.java:22)
Exception in thread "main"

I assume that you have traced the error back to the
Class.forName("com.mysql.jdbc.Driver");
effectively and but it seems little confucing becouse if you get any exception in above line it shoulde fire something like this
java.lang.NoClassDefFoundError: com/mysql/jdbc/Driver
blah..
blah
caused by:
so I tink the actual cause it something else
becouse when java is loading a class only the code the will be executed will be the class initialization code (static blocks) and if an initialization block fails giving an exception the class loading fails with a Class Not Found exception with the original exception as the cause.
I assume that the ClubhousesPanel is a class in your code
and does this line 13490 is the line that load mysql driver

Similar Messages

  • JDBC MySQL Connector/J problems when using in applets

    I wrote a piece of code which uses the MySQL Connector/J which worked in a normal shell application but when used in an applet it just didnt print anything. The code is:
    import java.net.*;
    import java.sql.*;
    class DB {
    static Connection c;
    static Statement stmt;
    static ResultSet to;
    public static String[] getUsers() {
         String str[] = new String[100];
         try {
              Class.forName("com.mysql.jdbc.Driver").newInstance();
         catch (Exception E) {}
         try {
              c = DriverManager.getConnection("jdbc:mysql://localhost/PROGRAM?user=blah&password=blah");
              stmt = c.createStatement();
              to = stmt.executeQuery("SELECT usr_user FROM usr");
              for(int i=0; to.next(); i++) str[i] = to.getString(1);
         catch (SQLException E) {}
         return str;
    Is there a problem accessing a MySQL Database via an applet

    Applet runs out of a sandbox, if you print the exception, you'll see that you have run into security access violation:
    catch (SQLException E) {
    E.printStackTrace();
    }This will tell you why your applet didn't print anything. Just a firendly advice, never try to catch something and don't display what was caught.
    ;o)
    V.V.
    PS: To solve, your problem, you can either sign the applet or use a policy file to grant the applet the required access right.

  • JDBC MySQL connector & autoexec.bat

    This what I entered into my autoexec file but when I run my java program it gives me a 'no suitable driver' error. I do not know what I should be entering for the
    'CLASSPATH' in the autoexec. Below is what I entered. The file jar file is located in my C:\unzipped\mysql-connector-java-3.1.7/ folder.
    C:\unzipped\mysql-connector-java-3.1.7\mysql-connector-java-3.1.7-bin.jar%CLASSPATH%
    Can somebody with knowledge in installing the JDBC driver for MySQL give me some help please.

    This works perfectly in the Eclipse IDE area that I have but when I run the same program on the Net Beans 3.6 IDE area it gives me a 'not suitable driver' error. To note these are both on the same computer. I would really like to get the Net Beans 3.6 IDE working because that is what I am most familiar with using. If you know of the problem why one IDE area recognizes the driver where the next does not I would sure like to know. Somebody passed the idea that when the 3.6 area is executed there are multiple instances running and it resets the ClassPath(I think they where shooting in the dark but it is a lead none the less). Anyway if anybody has had this problem please enlighten me, Thank-You.
    The ClassPath is set to the following:
    ClassPath = C:\Program Files\Java\jdk1.5.0_02\lib;C:\unzipped\mysql-connector- java-3.1.7\mysql-connector-java-3.1.7;C:\Program Files
    \Java\jdk1.5.0_02\jre\lib\ext;
    This is the code:
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Connect2 {
         public static void main(String[] args) {
              try {
                   // The newInstance() call is a work around for some
                   // broken Java implementations
                   Class.forName("com.mysql.jdbc.Driver");
              } catch (Exception ex) {
                   System.out.println("HERE");
              try {
                   String url = "jdbc:mysql://localhost/test";
                   String username = "root";
                   String password = "password";
                   Connection conn = DriverManager.getConnection(
                             "jdbc:mysql://localhost/test", "root", "password");
                   Statement c = conn.createStatement();
                   c.execute("insert into green values('richmond')");
                   c.execute("select * from green");
                   ResultSet rs = c.getResultSet();
                   while (rs.next()) {
                        System.out.println(rs.getString(1));
                   // Do something with the Connection
              } catch (SQLException ex) {
                   // handle any errors
                   System.out.println("SQLException: " + ex.getMessage());
                   System.out.println("SQLState: " + ex.getSQLState());
                   System.out.println("VendorError: " + ex.getErrorCode());
    }

  • Jdbc:mysql generating exception when ip address is included as part of url

    hie
    I recently wrote a java application that uses jdbc:mysql connector to connect to the mysql database. The problem I'm facing is ,- when ever I include IP addresses in the url on the getConnection method I get the following exception:
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection refused: connect
    The funny part is that if I use localhost on the url it works but generates the exception when I put the IP address of the local machine.
    Anybody who knows where the problem is , please help
    thanx in advance

    localhost usually resolves to 127.0.0.1, not the routable IP address of the host.
    mysql (or any TCP/IP based program) can tell which IP address you connected via.
    Your mysql installation apparently isn't configured to allow external connections. The problem could be persmissions or the installation itself, or a firewall on the host.
    See the fine manual:
    http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html
    http://dev.mysql.com/doc/refman/5.1/en/connection-access.html
    http://dev.mysql.com/doc/refman/5.1/en/security-guidelines.html

  • No suitable driver found for jdbc:mysql

    Running :
    Windows XP ver 5.1 on x86
    Java 1.6.0_03
    VM Java HotSpot Client VM 1.6.003-b05
    Java jdk1.6.0\jre
    MySQL ver 14.12 Distrib 5.0.45 for Win32 (ia32)
    NetBeans IDE 5.5.1 (Build 200704122300)
    Classpath set to:
    E:\Programfiler\Java\jre1.6.0_03\lib\ext\QTJava.zip;E:\Programfiler\MySQL\mysql-connector-java-5.1.5\mysql-connector-java-5.1.5-bin.jar
    MySQL (Connector/J driver)
    Can connect to database at Runtime folder in Netbeans IDE.
    Can see all tables and read them but when I run following code:
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    } catch (Exception e) {
    System.err.println(e.toString());
    I get following result;
    run:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    java.sql.SQLException:
         ://localhost:3306/test
    at java.sql.DriverManager.getConnection(DriverManager.java:602)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at viewtable01.Main.main(Main.java:43)
    BUILD SUCCESSFUL (total time: 0 seconds)
    PLEASE HELP, I'M GOING NUTS

    I'M GOING NUTSI'm already there...
    Try this at a new command prompt (start~run: cmd)
    $ dir E:\Programfiler\MySQL\mysql-connector-java-5.1.5\mysql-connector-java-5.1.5-bin.jarDoes it exist?
    If not then fix your classpath.
    If so then start~run: notepad ConnectorTest.java
    import java.sql.Connection;
    import java.sql.DriverManager;
    public class ConnectorTest {
      public static void main (String[] args) {
        Connection conn = null;
        try {
          String userName = args[0];
          String password = args[1];
          String url = "jdbc:mysql://localhost/test";
          Class.forName("com.mysql.jdbc.Driver").newInstance ();
          conn = DriverManager.getConnection(url, userName, password);
          System.out.println ("OK");
        } catch (Exception e) {
          e.printStackTrace();
        } finally {
          if(conn != null)try{conn.close();}catch(Exception eaten){}
    javac -cp E:\Programfiler\MySQL\mysql-connector-java-5.1.5\mysql-connector-java-5.1.5-bin.jar ConnectorTest.java
    java -cp E:\Programfiler\MySQL\mysql-connector-java-5.1.5\mysql-connector-java-5.1.5-bin.jar ConnectorTest ${username} ${password}When you've got it working at the command line then you can work out how to specify the libraries in netbeans... it's not hard, and it's very well covered in the netbeans help.
    You do know that netbeans doesn't use the system classpath don't you... because the classpath really needs to be specified on a project by project basis, mainly to allow you deal with libraries which depend on particular versions of other libraries. Ant's dependancy on xalan and xerces is a notable example.
    IMHO (in my humble opinion) newbies are better of working at the command prompt whilst learning the java language. A modern IDE is a complex beasty in it's own right, which tends to distract your main focus, learning java. I'm not alone in this opinion. Take it or leave it.
    Cheers, Keith.
    Edited by: corlettk on Nov 10, 2007 11:53 PM

  • Serious problem of jdbc-mysql connectivity using tomcat

    hi everybody
    i m in serious problem since last 15-20 days. i m trying hard to make the connection jdbc-mysql using tomcat with the help of a jsp test page but every time i am facing almost the similar probems listed below in detail:
    to make sure that the jdrivers's .jar (mysql-connector-java-3.1.7-bin.jar) available for such connections working fine i have tried the above said connection without using tomcat....which is working fine...for this i have created a dummy database with a dummy table ..and written some queries in the .java file of my code which upon running inserts the specified values in the defined(dummy) database.
    this is the confirmation that the classpath etc..are ok in regard to the mysql-connector-java-3.1.7-bin.jar
    now i have placed a copy of this .jar file in to the commons/lib directory of the tomcat web server(which is suppossed to be the place for such external jars)
    after doing so i have followed 2 methods :
    method 1st:........
    i have made aone more jar file from the following .java file....
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class TestSQLLoad
    String user = "Not Connected";
    String pwd = "no pwd";
    int id = -1;
    public void init() {
    try{
    Context ctx = new InitialContext();
    if(ctx == null ) {
    throw new Exception("Boom - No Context");
    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
    if (ds != null) {
    Connection conn = ds.getConnection();
    if(conn != null) {
    user = "Got Connection "+conn.toString();
    Statement stmt = conn.createStatement();
    String q = "select name, password, id from user";
    ResultSet rst = stmt.executeQuery(q);
    if(rst.next()) {
    user=rst.getString(1);
    pwd=rst.getString(2);
    id = rst.getInt(3);
    conn.close();
    }catch(Exception e) {
    e.printStackTrace();
    public String getUser() {
    return user;
    public String getPassword() {
    return pwd;
    public int getID()
    return id;
    after compiling it at the cmd prompt i made a .jar file from the .class of it and named it MySQLLoad.jar...then i placed it also in to the commons/lib directory where the mysql-connector-java-3.1.7-bin.jar was already placed.
    then i have changed the server.xml and web.xml files from the conf directory of the tomcat as given here:
    server.xml
    <!-- Example Server Configuration File -->
    <!-- Note that component elements are nested corresponding to their
    parent-child relationships with each other -->
    <!-- A "Server" is a singleton element that represents the entire JVM,
    which may contain one or more "Service" instances. The Server
    listens for a shutdown command on the indicated port.
    Note: A "Server" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <Server port="8005" shutdown="SHUTDOWN">
    <!-- Comment these entries out to disable JMX MBeans support used for the
    administration web application -->
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    </GlobalNamingResources>
    <!-- A "Service" is a collection of one or more "Connectors" that share
    a single "Container" (and therefore the web applications visible
    within that Container). Normally, that Container is an "Engine",
    but this is not required.
    Note: A "Service" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
    port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
    to 0 -->
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
    resourceName="UserDatabase"/>
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="/testdb" docBase="TOMCAT_HOME/webapps/tomcat-docs/testdb"
    debug="5" reloadable="true" crossContext="true" >
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_DBTest_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/TestDB"
    auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/TestDB">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>10</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>5</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections -->
    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>mysql</value>
    </parameter>
    <!-- Class name for mm.mysql JDBC driver -->
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost/testdb?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    </Context>
    </Host>
    </Engine>
    </Service>
    </Server>
    and the other xml file i.e
    web.xml is here:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
    <servlet-name>default</servlet-name>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/TestDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-cl ***>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.InvokerServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>fork</param-name>
    <param-value>false</param-value>
    </init-param>
    <init-param>
    <param-name>xpoweredBy</param-name>
    <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>abs</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ai</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aif</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aifc</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aiff</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aim</extension>
    <mime-type>application/x-aim</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>art</extension>
    <mime-type>image/x-jg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asf</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asx</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>au</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avi</extension>
    <mime-type>video/x-msvideo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avx</extension>
    <mime-type>video/x-rad-screenplay</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bcpio</extension>
    <mime-type>application/x-bcpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bin</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bmp</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>body</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cdf</extension>
    <mime-type>application/x-cdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cer</extension>
    <mime-type>application/x-x509-ca-cert</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>class</extension>
    <mime-type>application/java</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cpio</extension>
    <mime-type>application/x-cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>csh</extension>
    <mime-type>application/x-csh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dib</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dtd</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dv</extension>
    <mime-type>video/x-dv</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dvi</extension>
    <mime-type>application/x-dvi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>eps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>etx</extension>
    <mime-type>text/x-setext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>exe</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gif</extension>
    <mime-type>image/gif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gtar</extension>
    <mime-type>application/x-gtar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gz</extension>
    <mime-type>application/x-gzip</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hdf</extension>
    <mime-type>application/x-hdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htc</extension>
    <mime-type>text/x-component</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htm</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ief</extension>
    <mime-type>image/ief</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jad</extension>
    <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jar</extension>
    <mime-type>application/java-archive</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>java</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpe</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpeg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jsf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jspf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>kar</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>latex</extension>
    <mime-type>application/x-latex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>m3u</extension>
    <mime-type>audio/x-mpegurl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mac</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>man</extension>
    <mime-type>application/x-troff-man</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>me</extension>
    <mime-type>application/x-troff-me</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mid</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>midi</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mif</extension>
    <mime-type>application/x-mif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mov</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>movie</extension>
    <mime-type>video/x-sgi-movie</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp1</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp2</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp3</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpa</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpe</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpeg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpega</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpv2</extension>
    <mime-type>video/mpeg2</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ms</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>nc</extension>
    <mime-type>application/x-netcdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>oda</extension>
    <mime-type>application/oda</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pbm</extension>
    <mime-type>image/x-portable-bitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pct</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pdf</extension>
    <mime-type>application/pdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pgm</extension>
    <mime-type>image/x-portable-graymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pic</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pict</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pls</extension>
    <mime-type>audio/x-scpls</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnm</extension>
    <mime-type>image/x-portable-anymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnt</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppm</extension>
    <mime-type>image/x-portable-pixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppt</extension>
    <mime-type>application/powerpoint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>psd</extension>
    <mime-type>image/x-photoshop</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qt</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qti</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qtif</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ras</extension>
    <mime-type>image/x-cmu-raster</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rgb</extension>
    <mime-type>image/x-rgb</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rm</extension>
    <mime-type>application/vnd.rn-realmedia</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>roff</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtf</extension>
    <mime-type>application/rtf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtx</extension>
    <mime-type>text/richtext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sh</extension>
    <mime-type>application/x-sh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>shar</extension>
    <mime-type>application/x-shar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>smf</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sit</extension>
    <mime-type>application/x-stuffit</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>snd</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>src</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4cpio</extension>
    <mime-type>application/x-sv4cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4crc</extension>
    <mime-type>application/x-sv4crc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>swf</extension>
    <mime-type>application/x-shockwave-flash</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>t</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tar</extension>
    <mime-type>application/x-tar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tcl</extension>
    <mime-type>application/x-tcl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tex</extension>
    <mime-type>application/x-tex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texi</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texinfo</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tif</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tiff</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tr</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tsv</extension>
    <mime-type>text/tab-separated-values</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ulw</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ustar</extension>
    <mime-type>application/x-ustar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xbm</extension>
    <mime-type>image/x-xbitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xht</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xhtml</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xml</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xpm</extension>
    <mime-type>image/x-xpixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xsl</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xwd</extension>
    <mime-type>image/x-xwindowdump</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wav</extension>
    <mime-type>audio/x-wav</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svg</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svgz</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>vsd</extension>
    <mime-type>application/x-visio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Wireless Bitmap -->
    <extension>wbmp</extension>
    <mime-type>image/vnd.wap.wbmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Source -->
    <extension>wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML -->
    <extension>wmlc</extension>
    <mime-type>application/vnd.wap.wmlc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Script Source -->
    <extension>wmls</extension>
    <mime-type>text/vnd.wap.wmlscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML Script -->
    <extension>wmlscriptc</extension>
    <mime-type>application/vnd.wap.wmlscriptc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wrl</extension>
    <mime-type>x-world/x-vrml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>Z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>zip</extension>
    <mime-type>application/zip</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    after all this i have taken a jsp page whose code is here:
    (the mysql database used is named as "testdb" and the table name is "user" which is having fields name,password and id)
    <html>
    <head>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    and placed it in to the Tomcat 5.5\webapps\tomcat-docs\testdb directory and saved as test-db.jsp
    when i run this page on the browser i get a lot may errors stating
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    AND NOW WHEN just to get rid of such errords i try to include a statement
    <%@ page import="pkg.TestSQLLoad" %> in the jsp page code (and also place the MySQLLoad.class file in a folder called pkg and place it in the same directory where the jsp page is )and make it look like
    <html>
    <head>
    <%@ page import="pkg.TestSQLLoad" %>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    now when i run it i get the following errors:
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Only a type can be imported. pkg.TestSQLLoad resolves to a package
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    in response to the above error i have even tried placing the MySQLLoad.class directly in the testdb folder along with the jsp page without keeping it in a package named pkg and then importing directly as <@page import="MySQLLoad" %>
    that too gave me the following errors
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    The import TestSQLLoad cannot be resolved
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    and if i do not use the statement <%@ page import="MySQLLoad"%> then also i get the errors like
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    THE 2nd Method:
    in my second method i did the same changes in the web.xml and server.xml
    then i took a jsp page with the following code:
    <%@ page import="javax.sql.*,java.sql.*,javax.naming.*,com.mysql.jdbc.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> trial doc </TITLE>
    </HEAD>
    <BODY>
    <h1>Trial Document</h1>
    <% InitialContext context=new InitialContext( );
    DataSource dataSource=(DataSource) context.lookup("java:comp/env/jdbc/testdb");
    Connection conn=dataSource.getConnection();
    Statement stmt=conn.createStatement();
    ResultSet rset=stmt.executeQuery("select * from user");
    if (rset.next()){
    %>
    <table width="100%" border="1">
    <tr align="left">
    <th>name</th> <th>password</th><th>id</th>
    </tr>
    <%
    do {
    %>
    <tr><td> <%=rset.getString(1)%> </td>
    <td><%=rset.getString(2) %></td>
    <td><%=rset.getString(3) %></td></tr>
    <%
    } while (rset.next());
    %>
    </table>
    <%
    } else{
    %>
    No results from query
    <%
    rset.close();
    stmt.close();
    conn.close();
    context.close();
    %>
    </BODY>
    </HTML>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Connection is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Statement is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type ResultSet is ambiguous
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(C

    thanx for ur response
    as u said that the problem is more of a jsp page not getting compiled....
    me also pointed towards the similar situation providing all the surrounding situations
    which i have met and gone through
    i m still thinking that problem may b in the tomcat's server.xml and web.xml as well
    so better if u plz guide me in that regard
    regards,
    kuldeep

  • PreparedStatements and MySQL Connector/J

    Hi All,
    I was wondering what is the exact SQL statement that is passed to MySQL server when we use PreparedStatements. I was trying using MySQL Connector/J, type4 driver. I tried with a simple servlet
        public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException   {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<body>");
            out.println("<head>");
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   Connection con=DriverManager.getConnection("jdbc:mysql://localhost/mydb?user=root","root","");
                   //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   //Connection con=DriverManager.getConnection("jdbc:odbc:test");
                   PreparedStatement pst=con.prepareStatement("select * from AS_ITM where ID_ITM=?");
                   out.println("PreparedStatement = "+pst);
                   out.println("<br>");
                   pst.setString(1, "10");
                   out.println("PreparedStatement = "+pst);
                   //ResultSet rs=pst.executeQuery();
                   con.close();
              }catch(Exception e){
                   out.println(e);
            out.println("</head>");
            out.println("<body>");
            out.println("</body>");
            out.println("</html>");
    Here I am printing PreparedStatement  object's generated SQL twice and not even executing the query.
    And the result is:
    PreparedStatement = com.mysql.jdbc.PreparedStatement@19f3736: select * from AS_ITM where ID_ITM=** NOT SPECIFIED **
    PreparedStatement = com.mysql.jdbc.PreparedStatement@19f3736: select * from AS_ITM where ID_ITM='10'
    See second statement? I have not even sent it to the server.
    So is this jdbc driver preparing a simple Statement before it is sent to MySQL server?
    Is it what a jdbc driver is supposed to do? So then whats the use of PreparedStatement?Thanks,
    Kishor

    Hi,
    Just exactly what a JDBC driver is supposed to do with a PreparedStatement is not specified in JDBC I believe. I think they only requirement is that a PreparedStatement should be able to insert the various data types correctly into an SQL string.
    I am fully aware that PreparedStatements should also be able to give a better performance, for instance by only sending the parameters when you use it the second time, and not the whole the SQL. But I think this is up to the database and driver implementation to decide whether to do this, and how.
    Remember, the JDBC driver may be sending other information across to the database than the SQL. We can't see that from looking at the PreparedStatement only. You would have to use a network packet sniffer to see all data exchanged between the driver and the database
    -Jakob Jenkov

  • Mysql connector & ssl

    Hi,
    I have enabled ssl on my mysql server and am using useSSL=true&requireSSL=true in my jdbc connector url.
    I am getting the following error:
    The root cause was that: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** com.mysql.jdbc.CommunicationsException MESSAGE: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** javax.net.ssl.SSLHandshakeException MESSAGE: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target STACKTRACE: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)  at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187) at
    If anyone had any success connecting to mysql via ssl I would appreciate any help.
    Thanks!

    I used the mysql odbc connector with the certificate and it worked fine so
    the problem is not the certificate.
    2009/4/8 Alexei Yakovenko <[email protected]>
    drieh,
    >
    A new message was posted in the thread "mysql connector &amp; ssl":
    >
    http://forums.adobe.com/message/1877560#1877560
    >
    Author  : Alexei Yakovenko
    Email   : [email protected]
    Profile : http://forums.adobe.com/people/injun%20%5B576871%5D
    >
    Message:

  • JSTL - MySQL Connector problem

    Hello! I need your help. I don't actually know the reason, but *<sql:query>* doesn't work properly.
    So I have such a code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
    <sql:setDataSource var="datasource"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/publish"
    user="root" password="root"/>
    <sql:query var="books" dataSource="${datasource}">
    SELECT id, title, price FROM book
    </sql:query>
    <html>
    <head>
    <title>A First JSP Database</title
    </head>
    <body>
    <table border="1">
    <tr>
    <td>id</td><td>title</td><td>price</td>
    </tr>
    <c:forEach items="${books.rows}" var="row">
    <tr>
    <td><c:out value="${row.id}" /></td>
    <td><c:out value="${row.title}" /></td>
    <td><c:out value="${row.price}" /></td>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>The error I get when calling http://localhost:8080/DataAccess/bookList.jsp
    org.apache.jasper.JasperException: Exception in JSP: /bookList.jsp:7
    4:                  driver="com.mysql.jdbc.Driver"
    5:                     url="jdbc:mysql://localhost:3306/publish"
    6:                    user="root" password="root"/>
    7: <sql:query var="books" dataSource="${datasource}">
    8:   SELECT id, title, price FROM book
    9: </sql:query>
    10: <html>May be the reason is that the subfolder WEB-INF is badly configured.
    I have such subfolders in WEB-INF:
    */lib*
    jaxen-full.jar
    jdbc2_0-stdext.jar
    jstl.jar
    mysql-connector-java-3.0.9-stable-bin.jar
    saxpath.jar
    standard.jar
    xalan.jar
    xercesImpl.jar
    xml-apis.jar
    */tld*
    c-rt.tld
    c.tld
    fmt-rt.tld
    fmt.tld
    sql-rt.tld
    sql.tld
    x-rt.tld
    x.tldThe question is what is configured or done incorrectly? I am not quite familiar with JSP and JSTL. Thank you for any help.
    P.S I have already used MySQL. So it is set and configured as it is needed to be.

    ThomYork
    It didn't help.
    Just in case, I run tomcat 5.5.27-2 on Arch Linux; MySQL 5.0.77; Apache 2.2.11
    I tried to put mysql-connector-java-3.0.9-stable-bin.jar into
    /opt/tomcat/server/lib
    /opt/tomcat/shared/lib
    It didn't help.
    bandarurm
    After some manipulation i get such an error in my script:
    *exception*
    {noformat}org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}
    *root cause*
    {noformat}javax.servlet.ServletException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
         org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:89)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}
    *root cause*
    {noformat}javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
         org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
         org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
         org.apache.jsp.bookList_jsp._jspx_meth_sql_005fquery_005f0(bookList_jsp.java:130)
         org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:66)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}
    dsdsf
    I tried this. I downloaded the example with the source and WEB-INF directory. It doesn't work.
    Here is an error:
    *exception*
    {noformat}org.apache.jasper.JasperException: javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}
    *root cause*
    {noformat}javax.servlet.ServletException: javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
         org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspService(executeQuery_005fJstlSqlTag_jsp.java:116)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}
    *root cause*
    {noformat}java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
         java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
         java.lang.Class.forName0(Native Method)
         java.lang.Class.forName(Class.java:264)
         org.apache.taglibs.standard.tag.common.sql.DataSourceWrapper.setDriverClassName(DataSourceWrapper.java:46)
         org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:102)
         org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag.doStartTag(SetDataSourceTag.java:67)
         org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspx_meth_sql_005fsetDataSource_005f0(executeQuery_005fJstlSqlTag_jsp.java:137)
         org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspService(executeQuery_005fJstlSqlTag_jsp.java:88)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    {noformat}Nothing with sql query works. So it seems that the problem is in tomcat's configuration.

  • Help registering driver mysql-connector-j

    Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    Hello Everyone, I keep on getting a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    exception when I attempt to register the mysql-connector-j.
    I'm just using the code from it's documentation:
    public class LoadDriver {
    public static void main(String[] args) {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    } catch (Exception ex) {
    System.out.println(ex);
    I have a CLASSPATH 'user' variable containing...
    C:\JavaStuff; C:\mysql-connector-java-3.1.1-alpha\mysql-connector-java-3.1.1-alpha-bin.jar
    Where JavaStuff is the location of the LoadDriver class. I have to fix this thing as soon as possible as I'm currently working on a project. Much help will be apprecieated. I have a feeling it may be somthing to do with the classpath!

    It is the classpath.
    Do you really have a space after c:\javastuff? (You shouldn't.)
    Is that really the path to the jar file? And does that jar file really contain the driver class?
    I assume you are asking in the context of a Java application, which uses the CLASSPATH environment variable. Other possibilities (servlets, applets, executable jar files) have other ways of finding classes.

  • JDBC/MYSQL Connection problems

    I'm new to using JDBC so I'm not sure if I'm simply doing something wrong in my code or if I've installed something incorrectly. I've got the JDBC connector/J installed properly as far as I can tell. At least when I run my code I'm not getting an error about the driver not being found. The problem I'm running into is that even though I've double and triple checked the authentication info I keep getting the following error:
    Exception in thread "main" java.sql.SQLException: Invalid authorization specification message from server: "Access denied for user: '[email protected]' (Using password: YES)"
    The actual connection commands I'm using are as follows:
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Test", "testusr", "testpwd");
    I've checked and rechecked the spelling of my mySQL user & password and as far as I can tell, they work just fine so I can't figure out why I would be getting this error. Any suggestions on things I can try or does anyone see any obvious errors in what I'm doing?

    The failure is caused not by the JDBC driver but by how the MySQL was configured
    when it was installed. By default, MySQL is configured to allow connections that
    are created only from within the localhost.
    The line
    DriverManager.getConnection("jdbc:mysql://localhost:3306/Test?user=testusr& password=testpwd") translates to "create a connection to MySQL running at 'localhost' and use the
    'testusr@<hostname.domain>' as user name and 'testpwd' as the password".
    If you can see, the <hostname.domain> is replaced with "other value" aside from
    the "localhost" which you expect, hence connection is denied.
    The '<hostname.domain>' is replaced with the value of either your IP address or
    hostname. Therefore, any connections created from outside the host where your
    server is running will be denied. Now, making the 'host' value set from
    'localhost' to '%' would tell MySQL that you are allowing connections created from
    outside the MySQL host to connect to the server.
    Another way to go around this is problem is to modify your
    "\Windows\system32\drivers\etc\hosts" OR "/etc/hosts" file and give
    your loopback address (127.0.0.1) another alias (aside from localhost), e.g.:
    127.0.0.1    localhost    <hostnameY.domain>
    192.168.1.1  <hostnameX.domain>  <hostnameY.domain>where you replace <hostnameY.domain> with the name/alias of your computer in
    the network. The domain is optional and depends upon the domain name that
    your network is using.

  • JDBC, MySQL and the rudeness of SQLExceptions

    Hi there
    I'm having an annoying problem (no, really?).
    I've got a MySQL database running on a nice little Red Hat Linux server. It works just fine, and I can access it remotely from my windows desktop. So I'm trying to write a little client app.
    I'm using Windows XP with Java2 v1.4.01. For my JDBC drivers I'm using Connector/J (formerly mm.mysql). The connector/J jar is in jre\lib\ext. I have also unpacked it to C:\Java\Connector and linked directly to the jar in my CLASSPATH environment variable.
    So everything sounds right so far, yeah?
    Trouble is, every time I try to connect I get a rude "No Suitable Driver" error. I've searched extensively for material about this problem, but no solution I've tried seems to work. Any comments, suggestions etc will be appreciated.
    The test code is quoted below:
    import java.sql.*;
    public class MySQLClient{
    private boolean connected;
    private Connection conn;
    public MySQLClient(){
         connected = false;
    public boolean Connect(String userName, String userPwd){
    try {
         

    Hmmmm code was cut off. Here it is again.
    import java.sql.*;
    public class MySQLClient{
    private boolean connected;
    private Connection conn;
    public MySQLClient(){
         connected = false;
    public boolean Connect(String userName, String userPwd){
    try {
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         conn = DriverManager.getConnection(
    "jdbc:mysql:190.100.7.1:3306", userName, userPwd);
         connected = true;
         System.out.println("Connect OK!");     
         } catch (java.lang.ClassNotFoundException e){
    System.err.println("Can't find the freakin' driver");
         System.err.println(e.getMessage());
         } catch (java.lang.InstantiationException e){
         System.err.println("WTF???");
         System.err.println(e.getMessage());
         } catch (java.lang.IllegalAccessException e){
    System.err.println("Illegal access");
         System.err.println(e.getMessage());
    %

  • JDBC MYSQL Connection Problem

    Hi guys I have created a database called books in MySQL and I have the following code to test the link of connection. I am using Netbeans.
    import java.sql.*;
    public class jdbcexample1 {
    /** Creates a new instance of jdbcexample1 */
    public jdbcexample1() {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql:///books", "jhtp6", "jhtp6");
    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) {}
    However my program when run gives me the exception message which is
    "Exception: com.mysql.jdbc.Driver"
    Before you tell me, I have put the "mysql-connector-java-3.0.14-production-bin" in the ext folder of jre and I have also appended the CLASSPATH as follows.
    ".;C:\PATH\mysql-connector-java-3.0.14-production-bin.jar;" which leads to the jre ext folder.
    What am I doing wrong, Have I missed something above and if not what could be wrong with my setup.
    Thanks!! :)

    Helo,
    I have just started with java, I am also using netbeans, I used similar code to test the link, the code gives the following error when compiled:
    java.lang.NoClassDefFoundError: JdbcExample1
    Exception in thread "main"
    Java Result: 1
    The code I used is a s follows:
    package com.stardeveloper.example;
    import java.sql.*;
    public class JdbcExample1 {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql:///pet", "root", "siemens");
    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) {}
    Pls help..
    Thanks..
    Hi guys I have created a database called books in
    MySQL and I have the following code to test the link
    of connection. I am using Netbeans.
    import java.sql.*;
    public class jdbcexample1 {
    /** Creates a new instance of jdbcexample1 */
    public jdbcexample1() {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con =
    DriverManager.getConnection("jdbc:mysql:///books",
    "jhtp6", "jhtp6");
    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) {}
    However my program when run gives me the exception
    message which is
    "Exception: com.mysql.jdbc.Driver"
    Before you tell me, I have put the
    "mysql-connector-java-3.0.14-production-bin" in the
    ext folder of jre and I have also appended the
    CLASSPATH as follows.
    ".;C:\PATH\mysql-connector-java-3.0.14-production-bin.
    jar;" which leads to the jre ext folder.
    What am I doing wrong, Have I missed something above
    and if not what could be wrong with my setup.
    Thanks!! :)

  • How to force use of new JDBC MySQL Driver?

    Hi Everyone,
    In my local JDK(1.6)
    I have : "..\jdk\jre\lib\ext\mysql-connector-java-5.0.6-bin.jar" in my classpath.
    Under Netbeans, I have added Version 5.1.6 to my libraries, and added the library to my project.
    When running the preject locally with the code:
    DatabaseMetaData meta = con.getMetaData();
    String s1 = meta.getDriverVersion();It returns: mysql-connector-java-5.0.6
    So it's using the MySQL connector from the JDK rather than the new one I have specified.
    This problem is also reflected on the server, using the same project it retruns:
    mysql-connector-java-3.1.12.
    This is causing me really large problems, I need both the local and remote servers to be running the same version of the MySQL connector, preferably version 5.1.6.
    How can I force them to use the version I specify and not the default version from the JDK.
    Edited by: 3Pc on Mar 22, 2008 10:50 AM
    Edited by: 3Pc on Mar 22, 2008 11:00 AM

    jschell wrote:
    Per the other thread the source of the problem was a hosting company, so there isn't really a way to fix that in the VM except by asking or finding another company.
    Other than that one might be able to use a custom class loader to circumvent the normal class loading. It need to not call to the parent. Doing that with a JDBC driver would not be easy but it should be possible.True, but generally not worth the trouble though. If you have to go through that much work to use a hosting site, your far better off finding another hosting site.
    They seem to have problems understanding what they're doing anyway, if they are placing it in the ext directory. Web and Application containers have their own common lib directories for this sort of thing (if they want to provide a "common" driver) without messing around with the JDK itself (and I know you know this as well, I'm not saying this for your benefit, but rather for the OP's ;-) ).
    You really have to wonder what else they might have placed there. ;-)

  • Jdbc/mysql... unsuitable driver

    Hello,
    After 3 days, I finally got toplink and jdeveloper to work. My solution is probably not optimal, but it works. I'll describe my problem and my solution, both hoping that it can help someone having the same problem and that one could give me better guidelines ;-)
    The problem, which is described in similar threads, was that although toplink seemed to connect to my mysql db, and that the toplink 'test clients' I generated by right-clicking on toplink generated model files worked great, when I started my application, I had the infamous "unsuitable driver" error from toplink/oc4j/whatever.
    I had included the drivers in every possible location, or I thought so. So, this is just what I did to solve the problem, after an hopeless afternoon of trying almost everything: I just copied the mysql jdbc driver .jar to every possible location :-D ... and it worked. So, next, if fired up "filemon" to monitor the files the oc4j did really access, and it seems that the following action is enough to make it work:
    just copying mysql-connector-java-.jar to [jdev]\jdk\jre\lib\ext makes my server run 'fine' :-)
    Does anyone have a better location + ___THE CONFIGURATION CHANGES needed for it to work___?
    Meanwhile, I'll stick with this ugly, but working, solution. ;-)

    Copy the driver JAR file to
    C:\JDeveloper10.1.3\j2ee\home\lib
    or
    C:\JDeveloper10.1.3\j2ee\home\applib
    For BC4J directory copy JAR file to
    C:\JDeveloper10.1.3\BC4J\lib

Maybe you are looking for

  • Caret character in numbers (iWork09) not working with german keyboard

    The caret caracter used to express "power to" in formulas can not be typed into formulas with the german keyboard layout. Using the caret key nothing happens. For text and strings in cells the caret key works. In iWork08 everything is fine. For formu

  • Problem converting word doc into pdf

    I've just installed adobe acrobat 6.0 onto my laptop . Whenever I try to create a pdf file from a word doc it says there is a problem and will have to run in repair mode/ It then goes through the 'retrieving required info' instructs to restart the co

  • Portege M100 runs at 600MHz after BIOS/FRIMWARE upgrade

    Hello, I got a Portege M100 this week, installed Debian GNU/Linux (Sid) on it and nearly everything was fine. Then I upgraded to the latest BIOS/FIRMWARE (from V1.10 to V1.50) and now my Pentium M 1200 MHz runs at half speed. I can't also load cpufre

  • Deploy jw webservice to cluster server, always point to 9081

    i have cluster server(9081, 9082, 9083), when i deploy the helloword webservice generated by jwsc http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/use_cases.html, the dynamical wsdl always point to 9081,<s2:address location="http://lo

  • Problem updating phone code 3014 appears how can I esolve it?

    i  deleted all setting and donner of my iphone when he restart her self the apple still bloked and he didind boot i try to update but many error problem updating phone code 3014 appears how can I esolve it? and now he still always in recovery mod wha