Strange behaviour of jdbc-mysql driver

I am trying to store japanese characters in mysql and display also after reading from the database using JSP. I am using the following code.
<%@ page contentType="text/html; charset=UTF-8"%>
....... some code ......
<%
Class.forName( "org.gjt.mm.mysql.Driver" );
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/DB?useUnicode=true&characterEncoding=UTF-8", "user", "pass" );
Statement st = con.createStatement();
st.executeUpdate( "insert into test values('" + request.getParameter( "imgname" ) + "')" );
ResultSet rs = st.executeQuery( "select * from test" );
while( rs.next() ) {
%> DB Value: <%= rs.getString( "imgname" ) %>
<% } %>
I found one strange behaviour. I have to change the DriverManger.getConnection line to the following, to write the data correctly in the database.
DriverManager.getConnection("jdbc:mysql://localhost:3306/DB","user","pass")
If I read from the database using the same parameters as above, I am getting garbled data.
To retrieve the data correctly from the database I have to use the following line instead of the previous one.
DriverManager.getConnection("jdbc:mysql://localhost:3306/DB?useUnicode=true&characterEncoding=UTF-8", "user", "pass" );
In short, I have to pass different parameters to DriverManager.getConnection() for writing and reading from the database. But it is not possible practically. I am using mm.mysql-2.0.8 jdbc-mysql driver, mysql is 3.23.47 and english windows 2000.
I have tried the string.getBytes("UTF-8") and new String( getBytes(string), "UTF-8") methods, but not getting the correct data.
Can anybody guide me how can I store and display the japanese character correctly?
Thanks to all,
gaurang.

I downloaded the latese driver from sourceforge, but still the same thing is happening. Is there any other thing which I should do?
Thanks
gaurang.

Similar Messages

  • Strange behaviour of JDBC query for CHAR column

    Hi,
    I have a simple table with char type and several records in the table.
    create table char_test(str char(50));
    insert into char_test values ('abc');
    insert into char_test values ('abc ');
    insert into char_test values ('abc ');
    In JDBC, if I have a query like
    PreparedStatement st = conn.prepareStatement("select str from char_test where str = 'abc'");
    ResultSet rs = st.executeQuery();
    All three rows will be returned.
    However, If I use parameter for the PreparedStatment, nothing will be returned if the value of the parameter is passed as "abc".
    PreparedStatement st = conn.prepareStatement("select str from char_test where str = ?");
    st.setString(1, "abc");
    ResultSet rs = st.executeQuery();
    Personally, I think this is a bug of Oracle JDBC driver. Could anybody please give me any explanation?
    Thanks,
    Bill
    PS. I'm using Oracle 10g Release 2 DB and ojdbc14.jar under jdk 1.5.

    Hello Bill,
    Have you solved your problem ?
    I have encountered a similar one and found a strange behavior of JDBC driver for PrepareStatement : in some cases, deep in JDBC driver, the parameter values could'nt be convert and are send as null values to the server.
    Here are partial driver logs, the first for a program which works fine and the second for one which turns on error.
    ============================
    <record>
    <date>2006-09-06T16:27:43</date>
    <millis>1157552863218</millis>
    <sequence>335</sequence>
    <logger>oracle.jdbc.conversion</logger>
    <level>FINE</level>
    <class>oracle.jdbc.driver.DBConversion</class>
    <method>javaCharsToCHARBytes</method>
    <thread>10</thread>
    <message>DBConversion.javaCharsToCHARBytes(chars[]= (26 bytes):
    00 0c 00 65 00 78 00 70 00 73 00 74 00 6f 00 0a 00 73 00 6c
    00 65 00 65 00 70 , charOffset=1, bytes[]= (7 bytes):
    00 00 00 00 00 00 00 , byteOffset=0, cs=178, nchars=6)</message>
    </record>
    <record>
    <date>2006-09-06T16:27:43</date>
    <millis>1157552863218</millis>
    <sequence>336</sequence>
    <logger>oracle.jdbc.conversion</logger>
    <level>FINE</level>
    <class>oracle.jdbc.driver.DBConversion</class>
    <method>javaCharsToCHARBytes</method>
    <thread>10</thread>
    <message>DBConversion.javaCharsToCHARBytes(chars, nchars, bytes[], cs): returned 6</message>
    </record>
    =============================
    javaCharsToCHARBytes gets 6 characters OK
    =============================
    <record>
    <date>2006-09-06T16:12:32</date>
    <millis>1157551952843</millis>
    <sequence>333</sequence>
    <logger>oracle.jdbc.conversion</logger>
    <level>FINE</level>
    <class>oracle.jdbc.driver.DBConversion</class>
    <method>javaCharsToCHARBytes</method>
    <thread>10</thread>
    <message>DBConversion.javaCharsToCHARBytes(chars[]= (40 bytes):
    00 26 00 73 00 74 00 6f 00 72 00 61 00 67 00 65 00 5f 00 53
    00 74 00 6f 00 72 00 65 00 2e 00 71 00 75 00 65 00 72 00 79 , charOffset=1, bytes[]= (20 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 , byteOffset=0, cs=178, nchars=19)</message>
    </record>
    <record>
    <date>2006-09-06T16:12:32</date>
    <millis>1157551952843</millis>
    <sequence>334</sequence>
    <logger>oracle.jdbc.conversion</logger>
    <level>FINE</level>
    <class>oracle.jdbc.driver.DBConversion</class>
    <method>javaCharsToCHARBytes</method>
    <thread>10</thread>
    <message>DBConversion.javaCharsToCHARBytes(chars, nchars, bytes[], cs): returned 0</message>
    </record>
    =============================
    javaCharsToCHARBytes gets 0 characters instead of 19
    But I am unable to discover the differences between the 2 programs in the JDBC driver usage.
    Does this sounds familiar to someone ?
    François

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

  • Strange behavior of JDBC Adapter

    Hello everybody!
    I found a pretty strange behaviour of JDBC Receiver Adapter during problems with network (big thanks to our Basis). According to the status in Adapter Engine, the message wasn't processed. In the database I can see these inserts. However, there are more lines in the XML than lines in the database. So, how it is possible that adapter commits only part of inserts. Logs and settings see below.
    My XML includes a SQL_DML statement and a few INSERT statements, each contains many inserts.
    It looks like that:
    <?xml version="1.0" ?>
    <MyMessage>
        <statement>
            <table1 action="SQL_DML">
                <access>here I delete old values</access>
            </table1>
        </statement>
        <statement>
            <table2 action="INSERT">
                <access>some data</access>
            </table2>
        </statement>
        <statement>
            <table3 action="INSERT">
                <access>some data</access>
            </table3>
        </statement>
    </MyMessage>
    Part of adapter log is here:
    Information
    Message successfully put into the queue
    Information
    The message was successfully retrieved from the receive queue
    Information
    Message status set to DLNG
    Information
    Delivering to channel: Adapter_Name
    Information
    MP: processing local module localejbs/CallSapAdapter
    Information
    Receiver JDBC adapter: processing started; QoS required: ExactlyOnce
    Information
    JDBC Adapter Receiver Channel Adapter_Name: Processing started; party / service BS
    Information
    Database request processed successfully
    Error
    MP: exception caught with message Ack handling failed: creation of messageFactory failed: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Connection JDBC_http://sap.com/xi/XI/System is currently not started.
    Error
    Exception caught by adapter framework: Ack handling failed: creation of messageFactory failed: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Connection JDBC_http://sap.com/xi/XI/System is currently not started.
    Error
    Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Ack handling failed: creation of messageFactory failed: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Connection JDBC_http://sap.com/xi/XI/System is currently not started.
    Information
    Message status set to WAIT
    Information
    The asynchronous message was successfully scheduled to be delivered at ...
    Information
    Message status set to TBDL
    Information
    Retrying to deliver message to the application. Retry: 1
    Information
    The message was successfully retrieved from the receive queue
    Information
    Message status set to DLNG
    Information
    Delivering to channel: Adapter_Name
    Information
    MP: processing local module localejbs/CallSapAdapter
    Information
    Receiver JDBC adapter: processing started; QoS required: ExactlyOnce
    Information
    JDBC Adapter Receiver Channel Adapter_Name: Processing started; party / service BS
    Error
    Unable to execute statement for table or stored procedure. 'Table' (Structure 'statement') due to com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'fields'. Cannot insert duplicate key in object 'Table'. The duplicate key value is (field values).
    Error
    JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'Table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'fields'. Cannot insert duplicate key in object 'Table'. The duplicate key value is (field values).
    Error
    MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'Table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'fields'. Cannot insert duplicate key in object 'Table'. The duplicate key value is (field values).
    Error
    Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'Table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'fields'. Cannot insert duplicate key in object 'Table'. The duplicate key value is (field values).
    Error
    Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'Table' (structure 'statement'): com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY constraint 'fields'. Cannot insert duplicate key in object 'Table'. The duplicate key value is (field values).
    Adapter settings:
    Maximum concurrency: 20
    Persistence: Local
    Conflict Resolution: Redo
    Advanced Mode: On
    Number of Retries of Database Transaction on SQL Error: 0
    Transaction Isolation Level: serializable

    Dear All,
    Follow the steps below to resolve the "Connection JDBC_http://sap.com/xi/XI/System is currently not started." issue:
    1. Log in to NWA
    2. Navigate to Operations -> Systems -> Start & Stop
    3. Click on Java Services tab
    4. Search  the service Service "XPI Adapter: JDBC"
    5. Select the service XPI Adapter: JDBC and click on Restart button
    With the restart of JDBC Service in NWA, the channels should start working properly
    Regards,
    Shreyansh

  • Help with jdbc - mysql

    os windows 2000
    mysql installed.
    code below:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class mainFrame {
    JPanel mainPane;
    JButton theButton;
    Action e;
    public void mainFrame()
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (Exception e) {};
    mainPane = new JPanel(true);
    theButton = new JButton("Click me to close this window!");
    e = new AbstractAction(){
    public void actionPerformed(ActionEvent d)
    System.exit(0);
    theButton.addActionListener(e);
    mainPane.add(theButton);
    try
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
    catch (Exception e)
    public static void main(String args[])
    mainFrame mf = new mainFrame();
    mf.mainFrame();
    JFrame mainWindow = new JFrame("mainWindow");
    mainWindow.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    mainWindow.setContentPane(mf.mainPane);
    mainWindow.pack();
    mainWindow.setVisible(true);
    ============================
    i get the error message while i run :
    Exception in thread "main" java.lang.NoClassDefFoundError: com/caucho/vfs/LogStream
    at com.caucho.jdbc.mysql.Driver.<clinit>(Driver.java)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at CreateCoffees.main(CreateCoffees.java:17)
    what could this mean ?
    thanks
    CyFox

    sorry, code is :
    import java.sql.*;
    public class CreateCoffees {
    public static void main(String args[]) {
    String url = "jdbc:mysql-caucho://localhost:3306/menagerie";
    Connection con;
    String createString;
    createString = "create table COFFEES " +
    "(COF_NAME VARCHAR(32), " +
    "SUP_ID INTEGER, " +
    "PRICE FLOAT, " +
    "SALES INTEGER, " +
    "TOTAL INTEGER)";
    Statement stmt;
    try {
    Class.forName("com.caucho.jdbc.mysql.Driver");
    } catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url, "root", "123456");
    stmt = con.createStatement();
    stmt.executeUpdate(createString);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());

  • 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

  • Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'

    Hi,
    I'm trying to run my web app and connect to a MySQL database but keep getting this error:
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.gjt.mm.mysql.Driver'
    any ideas?
    Thanks!

    Lookup the stacktrace and find the root cause of the exception.
    My cents on a ClassNotFoundException which is rather self-explaining.
    By the way, the mentioned driver class name is a very old driver. You shouldn't be using that anymore. Surf to the MySQL homepage and download the most recent Connector/J JDBC driver for your database version. Documentation is also available over there.

  • Strange problem with JDBC URL

    Hi All,
    I don't know whether this is a known issue which has a workaround or I am doing something wrong. But this is the problem.
    I have a nice GUI application which takes the JDBC URL, Driver, User name and password and then takes the input and tries to establish a connection with the Database. I was trying it on MySQL and I encountered a problem.
    The general format of the JDBC URL for MySQL is "jdbc:mysql://<ip_address>:<port>/<db_name> and if I have MySQL running on 3306 and if I give the URL as:
    "jdbc:mysql://localhost:9001" (where my HSQL is running), then, it never gets the connection and the application stays there forever (the call never returns after the DriverManager.getConnection() statement). And if I give the port as something else (say 9898) where nothing is running, then the getConnection() doesn't send me a SQLException.
    What could be the problem?

    Are you saying that you're connecting using the
    MySQL driver to an HSQL database, and
    that this results in a hang (rather than a timeout)?
    Just to clarify that I've understood the problem.
    If so, it should be fairly easy to get a simple test
    scenario up and running independent from your "real"
    application. Have you tried this, and could you post
    the code if so?
    Dave.Hi Dave,
    Thank you very much trying,
    Sorry if my English was poor. I am not trying to connect to HSQLDB using the MySQL Driver.
    Actually, I am trying to connect to MySQL db using the MySQL driver, but the DriverManager.getConnection() method hangs when I...
    1. Give a wrong URL e.g(jdbc:mysql://localhost:9001/")
    2. Run my MySQL on default port (3306)
    3. And If I have HSQL or any other program that is listening at port 9001.
    The problem seems to be very strange. here's the code below, you can try out yourself...
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Demo {
         public static void main(String[] args) {
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   DriverManager.getConnection("jdbc:mysql://localhost:9001/", "user", "password"); // <-- The call hangs here
              } catch (SQLException e) {
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
    }Remember to have your mysql*.jar file in your classpath while running. :)
    Thank you....

  • Strange Behaviour in Pentium IV machine

    Hi all. I put this post in Java HotSpot forum, but that forum seems not to be as popular as this, so I've decided to post it here too.
    I've been reading posts in this forum (and another in this site) for more than a week trying to find any idea that could help me with my "strange" problem, but with no success.
    I've developed an application that manages some info stored in Mysql. My developing machine is a Pentium II (400MHz) with Red Hat 7.3 Valhalla installed. I use Mysql 3.23.49 and J/Connector (version 2.0.14) downloaded from Mysql site and JRE version 1.4.1.-b21.
    The production machine is a Pentium IV (1.60 GHz) , with the same Red Hat version, the same JRE version and Mysql 3.23.51.
    Well, in developing machine I am able to run up to 4 instances of the application witout crashing, only decreasing timing performance. But in production machine, I get and "strange" behaviour. Sometimes (1 of each 10 times) the application crashes (even the machine crashes sometimes), and I get Hot Spot log files (hs_err_pid####.log) like these
    Type 1 ------------------------------------->
    Unexpected Signal : 11 occurred at PC=0x403291D8
    Function=skip_method_invoke_and_aux_frames__12vframeStream+0x58
    Library=/usr/java/j2sdk1.4.1/jre/lib/i386/client/libjvm.so
    Current Java thread:
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.io.Converters.getDefaultEncodingName(Converters.java:66)
    at java.lang.StringCoding.decode(StringCoding.java:226)
    at java.lang.String.<init>(String.java:383)
    at com.mysql.jdbc.Buffer.readLenString(Unknown Source)
    at com.mysql.jdbc.MysqlIO.getResultSet(Unknown Source)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source)
    at com.mysql.jdbc.MysqlIO.sqlQuery(Unknown Source)
    at com.mysql.jdbc.Connection.execSQL(Unknown Source)
    - locked <0x448f92d0> (a com.mysql.jdbc.jdbc2.IO)
    at com.mysql.jdbc.Connection.execSQL(Unknown Source)
    at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
    - locked <0x448f92d0> (a com.mysql.jdbc.jdbc2.IO)
    at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
    at GeneraTablaDiasCerrados.<init>(GeneraTablaDiasCerrados.java:99)
    at GeneraTablaDiasCerrados.main(GeneraTablaDiasCerrados.java:425)
    Type 2------------------------------------------------>
    Unexpected Signal : 11 occurred at PC=0x424AC980
    Function=sqlQueryDirect (//or nextRow//) (compiled Java code) (or nextRow)
    Library=(N/A)
    Current Java thread: (//No output in this case//)
    Type 3------------------------------------------------------>
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x4212E3B0
    Function=(null)+0x4212E3B0
    Library=java
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
    - locked <0x44901b38> (a java.io.BufferedInputStream)
    at com.mysql.jdbc.MysqlIO.readPacket(Unknown Source)
    at com.mysql.jdbc.MysqlIO.sendCommand(Unknown Source)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source)
    at com.mysql.jdbc.MysqlIO.sqlQuery(Unknown Source)
    at com.mysql.jdbc.Connection.execSQL(Unknown Source)
    - locked <0x448f92e8> (a com.mysql.jdbc.jdbc2.IO)
    at com.mysql.jdbc.Connection.execSQL(Unknown Source)
    at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
    - locked <0x448f92e8> (a com.mysql.jdbc.jdbc2.IO)
    at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
    at GeneraTablaDiasCerrados.<init>(GeneraTablaDiasCerrados.java:99)
    at GeneraTablaDiasCerrados.main(GeneraTablaDiasCerrados.java:425)
    ---------------------------------------------->
    After this text, I get Dynamic libraries info.
    I can't figure out what's happening. I have read in these forums that Signal 11 is about Segmentation Fault, or JVM trying to write in forbidden positions.
    Later I read that JVM could crash on Pentium IV processors under certain circumstances, but isn't those issues supossed to be fixed in version 1.4.1?
    The last trail I'm following is J/Connector, because in error messages type 2 and 3 are involved mysql classes. But it doesn't explain the fact that in developing machine everything runs properly.
    I also consider the posibility of corrupted files in hard disk, but all of them seem to be OK (sizes in production machine matches those in developing machine).
    Can anyone help me showing me another trail to follow?
    Thanks to all in advance.
    Note: Please, forgive my English and the length of this post.

    Hi OMcGovern. Thanks for your answer.
    I've a couple of theorys,
    1) The second last stack trace call is for encoding.
    The basic US version of the JRE only supports about
    ut 8 basic encoding schemes. You could try running it
    with the international version of the JRE.
    ( To check version : if i18n.jar is in JRE's lib
    directory, it's the international version )I've checked it and I don't have the international version (not in production machine and not in developing machine). I downloaded the "Linux RPM in self-extracting file" version, (in both cases) and there is no choice for downloading any "international" version or something like this. I'll search for it in sun site. It seems to be a good guess to follow, because production machine is allocated in the USA, and developing machine is here in Spain.
    2) Running java -Xint ( interpreted mode ), might
    rule out any hotspot errors. It could give you more
    debugging information too.
    Worth a shot.I'm not running with that option.
    3) It doesn't quite make sense that the last stack
    trace entry is a
    security call, in an application. Are you doing
    ng anything strange ?
    Eg. writing your own classloaders or the like ?No I'm not doing. Maybe a problem with J/Connector, but my deep doubt and what's driving me crazy is : Why is runnig all ok (I was really proud of this fact because this is my first "big" app in Java) in my developing machine and crashing in production machine?
    I'll look for i18n.jar, will install it and let's see what happens..
    Thanks again.

  • Unable to load mySql Driver in Java class invoked using bpelx:exec

    Hi ,
    I am trying to connect to mysql database in my java class.when i run this class in Jdeveloper it loads the driver without any problem.I can chk the log in the Jdev messages area.Now I am invoking this class from the BPEL process through <bpelx activity.But when i run my BPEL process it throws runtime exception "classNotFoundException:unable to load com.mysql.jdbc.Driver".I have set the project properties ->libraries to the class path of the mysql jar file as well.
    Now if i try to connect with the Oracle driver then it is working fine.
    I know this is a classpath issue.Can anyone tell me if there are some other settings to make it work fine.
    the java code :
    System.out.println("in getConnection method");
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("loaded Driver :");
    String url="jdbc:mysql://ntlv014:3306/wx";
    _jdbcConnection = DriverManager.getConnection(url,"development","ber1nger");
    System.out.println("Got Connection :"+_jdbcConnection.isClosed());                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I think you have 2 options..
    either put the jar for the mysql in the classpath on the server...or try something like this :
    http://forum.java.sun.com/thread.jspa?forumID=17&threadID=633158
    try to put the jar of the mysql into the suitecase of the bpel.
    never seen this coming around...so..it's just a wild guess.
    ORABPEL-11622 Could not create/access the TopLink Session
    spendem got the same situation...the puts the libraries in the applib-dir
    Message was edited by:
    Eric Elzinga (IT-Eye)

  • How to load mysql driver in netbeans 5.0

    I configured mysql driver(com.mysql.jdbc.Driver) in netbeans 5.0. but i got this type of errors
    (run:
    Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at gdb.gdbop.main(gdbop.java:20))
    plz help me for this...............

    IDEs such as netbeans and eclipse require you to add any external jars to the project's classpath.
    for netbeans 5.0, see here:
    http://www.netbeans.org/kb/50/using-netbeans/project_setup.html#pgfId-1157099

  • Mysql driver issue with Deploytool 1.3

    Hi,
    I would like to have J2EE 1.3 container managed entity beans being able to talk with a Mysql database . I have added my jar file to deploytool and have the mysql database server running and the database table ready to be used. I am using Mysql Connector Java 3.0 and have put the required driver jar file into the ext directory of the JAVA_HOME path. I have windows XP.
    Here is my configuration in deploytool :
    Tools--> Server configuration --> Data source --> standart
    JDBC driver : com.mysql.jdbc.Driver
    JNDI name : jdbc/zob
    JDBC url : jdbc:mysql (the database is running on localhost and the table to use is ready)
    Then in the entity tab of my bean --> Deployment Settings --> Database Settings, I put jdbc/zob as JNDI name. No username or password is required.
    If I try to generate Default SQL, I get the following error:
    Erroe: while generating SQL
    java.rmi.ServerException:RemoteException occured in server thread;nested exception is:
    java.rmi.RemoteException: Error connecting to database;nested exception is:
    java.sql.SQLException:No suitable driver
    Please make sure the database name/user/password is valid and the J2EE server and database are running.
    I would be very grateful for help because I can't see what is missing or wrong. Thank you very much in advance.

    First thing to do is try to narrow in on the problem a little bit. Try writing a simple test JSP or something that runs on the container to manually get a Connection from your Connection Pool. Then do a simple query to make sure you can actually connect.
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/zob");
    Connection conn = ds.getConnection();
    do your test query
    ...Once you have established that your Connection Pool is working, then go ahead and try to get your entity bean working. I haven't used MySQL before, I have always used Oracle on some remote server, never on localhost. Maybe the URL convention is different when it's on localhost, but it seems like you're missing the host, port, and instance parts; you just have the driver.
    I'm sure you've already checked this but I'll say it just in case, make sure you have your driver class somewhere that the container can see it. I know, it's obvious, but you never know...
    Good luck!!

  • Mysql driver and Jbuilder 2005 foundation

    I am trying to connect to a mysql server using jdbc and the mysql drivers. Specifically version 3.1.7. I will post my code here although I believe the code is correct and that I have a classpath issue with jbuilder. The error I am receiving on both build and run time is:
    Exception in thread "main" java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at methodclassespkg.DummyTester.main(DummyTester.java:39)
    I installed the mysql .jar driver file in the jdk1.5/lib/ext as the read me file that came with the drivers stated. I have changed the default jdk to the jdk1.5 update 2 that I installed. I imoprted the .jar driver file into the project and even added the file under tools/configure/libraries. But I still receive this error witht his code
    package methodclassespkg;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.io.*;
    Class Name: Dummy Tester Class
    Description: A dummy class with a main to test the other classes functionality.
    Company: Team SSJ (7)
    Copyright (c) 2005
    Version 1.0
    public class DummyTester {
    public DummyTester() {
    try {
    jbInit();
    } catch (Exception ex) {
    ex.printStackTrace();
    public static void main(String[] args) throws SQLException, IOException{
    try{
    Class.forName("com.mysql.jdbc.Driver");
    catch(ClassNotFoundException e){
    System.out.println("Could not load the driver");
    Connection conn = DriverManager.getConnection("ServerName", "user", "password");
    System.out.println("test");
    private void jbInit() throws Exception {
    Again I am running the free version which does not allow me to access the enterprise tab, I mention this because I saw a solution to this issue that allowed for importing the database driver using tools/enterprisesetup/database drivers. but I do not have access to this functionalitity.
    Jeremy Reed

    Thank you for the fast response from everyone. WIth you assistance I did reach a solution. I turns out I wasnt calling the driver correctly, syntactlically.
    For anyone googling a similar issue as mine, for j connect, your statement must be in the form of jdbc:mysql://yourhost/database?user=name&password=password
    that was my mistake

  • Windows 8.1 Enterprise Evaluation- Strange behaviour of network adapter

    Hello there are discussions and questions around this community about network adapter dropping connection while system is running. But I have found unique problem with my network adapter driver.
    I have tried to state my problem as clearly as possible. Please ask if any detail is required.
    My network status shows no access on following occasions:
    1. On alternate system wakeups.
        eg:  
    a. System boots up 
    Internet accessible
    no problem
    b. I put system to sleep(first time) and wake it up
    No access to internet !!!
    When I check in network and sharing center not even adapter shows in disabled status.(See video from the link given below).
    c. Without restarting system or without installing network adapter again,  I put system to sleep again and wake it up (2nd time).
    Internet accessible
    d. I put system to sleep for (3rd time) and wakes it up.
    No access to internet!!
    If I put system to sleep again and wake it up definitly I get network access.
    2. If I switch off the modem before windows shutdown completely or in the process of shutdown, next time when I boot system, even though the modem is switched on before booting the system, No internet access tooltip will be shown on network
    sysbol.
    Another strange behaviour is on no internet access status, I start installing adapter, and it loads required files and prompt me to click "next" and "click" install.
    But the thing is before I go to "next" button, I will get network access as shown in this link
    http://youtu.be/sPlXVEiYBeo. Ignore virtualbox adapter. Same behaviour was there when there is no vbox adapter. Same was happening in Windows 8 Pro, but not in windows 7, so that there is no H/W problem I think. 
    Any idea on how to fix this or any alternate solution ? 

    Hi,
    Firstly, access your network adapter official website to get the proper driver applied to your system.
    Then going to Control Panel > Device Manager, right click your adapter > Properties. Under the Power Management tab, make sure "Allow the computer to turn off this device to save power" checkbox unchecked.
    If it still persists, try to disable "fast startup" as below steps:
    1.In Control Panel, open the Power Options item.
    2.Click the Choose what the power buttons do link.
    3.Clear the Turn on fast startup (recommended) check box.
    4.Click Save Settings.
    Karen Hu
    TechNet Community Support

  • 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

Maybe you are looking for