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

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

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

Similar Messages

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

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

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

  • Cannot load JDBC driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver

    Hi,
    i am doing a forum application.
    i am trying to connect database connection through javax.sql.DataSource.
    I am using Eclipse editor for developing this application and i am using sql server 2000 database.
    i have create a servlet file.
    here is the coding.
    DatabaseGetConnection.java
    `````````````````````````````````````````
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.sql.DataSource;
    public class DatabaseGetConnection extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    private Connection con=null;
    private DataSource ds=null;
    public DatabaseGetConnection() throws ServletException {
    super();               
    public DatabaseGetConnection(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
    this.doPost(req, res);          
    public void init() throws ServletException {
    try
    final Context initContext = new InitialContext();
    final Context envContext = (Context)initContext.lookup("java:/comp/env");
    this.ds = (DataSource)initContext.lookup("jdbc/mySQLServer");
    }catch(final NamingException ne)
    ne.printStackTrace();
    }catch(final Exception e)
    e.printStackTrace();
    public DataSource getDS()
    System.out.println("Datasource method calling");
    if (this.ds!=null)
    System.out.println("Datasource not null");
    }else
    System.out.println("Datasource null");
    return this.ds;
    public Connection getCon()
    try
    this.con=this.getDS().getConnection();
    if (this.con!=null)
    System.out.println("Connection Successfull");
    }catch(final SQLException se)
    System.out.print("Connection Establishment Error : ");
    se.printStackTrace();
    return this.con;
    I have configured server.xml. here is the configuration
    server.xml
    ````````````````
    <GlobalNamingResources>
    <Resource name="jdbc/mySQLServer" global="jdbc/mySQLServer" auth="Container"
    type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=forum;SelectMethod=cursor"
    username="sa" password="sa" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </GlobalNamingResources>
    here is the web.xml file
    ``````````````````````````````````
    <resource-ref>
    <res-ref-name>jdbc/mySQLServer</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    is this configuration correct? plz help me about the configuration and coding through Eclipse.
    i have run the application and i got the error. here is the error details
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:766)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
    at com.forum.database.DatabaseGetConnection.getCon(DatabaseGetConnection.java:85)
    at com.forum.database.DatabaseGetConnection.GetAllTopicSearch(DatabaseGetConnection.java:101)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:73)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:760)
    ... 24 more
    thanks and regards,
    k.s.kumar

    Please don't multipost, it's rude: http://forum.java.sun.com/thread.jspa?threadID=5219591
    Please continue on that thread.

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

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

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

  • Cannot load login module class

    Hi,
    i'm working on customizing Login Module now.
    i have bulit the project and deploy the SDA file follow this link "[sap help|http://help.sap.com/saphelp_nw70/helpdata/en/76/08b34095070361e10000000a155106/frameset.htm]".
    My Java project name is: MyLoginModule, with class file "MyLoginModuleClass" in "com.mycompany" package.
    And my library project name is: MyLoginModuleLibrary, with "MyLoginModule.jar" in Jars,
    and with "security_api" "com.sap.tc.logging" "com.sap.engin.lib.add_ejb" "security.class" "com.sap.security.api.sda" "com.sap.security.core.sda" in reference
    After these steps, logon is failed.
    and i get some log using "Note 1045019 - Web diagtool" below:
    LOGIN.FAILED
    User: N/A
    Authentication Stack: ticket
    Login Module                                                               Flag        Initialize  Login      Commit     Abort      Details
    1. com.sap.security.core.server.jaas.EvaluateTicketLoginModule
    --- SUFFICIENT  ok          false                 true      
    2. com.mycompany.MyLoginModuleClass
    --- OPTIONAL                                                 Cannot load login module class. com.mycompany.MyLoginModuleClass
    Found in negative cache
    ---Loader Info ---
    ClassLoader name: [common:library:com.sap.security.api.sda;library:com.sap.security.core.sda;library:security.class;library:webservices_lib;service:adminadapter;service:basicadmin;
    service:com.sap.security.core.ume.service;service:configuration;service:connector;service:dbpool;service:deploy;service:jmx;service:jmx_notification;service:keystore;service:security;service:userstore
    Parent loader name: [Frame ClassLoader]
    References:
    Why didn't i see MyLoginModuleLibrary in "ClassLoader name" though i've add it in ConfigTool already.
    Maybe this is the reason  "cannot load login module calss com.mycompany.MyLoginModule"?
    Any  suggestion?
    Regards,
    Fishy

    hi
    this will give some idea
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2b/23e4407211732ae10000000a155106/content.htm
    http://docs.sun.com/app/docs/doc/820-4801/gbyuw?a=view
    Re: Deploying a custom login module to the J2EE engine
    bvr
    Edited by: bvr on May 7, 2009 12:53 PM

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

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

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

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

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

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

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

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

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

  • Help with com.mysql.jdbc.Driver

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

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

  • Cannot import com.mysql.jdbc.exceptions

    Hi all,
    I have a pretty simple question.
    Why it is not possible to import classes from the package com.mysql.jdbc.exceptions?
    My classpath is set up correctly I can use jdb driver to connect to my db, but if I try to import com.mysql.jdbc.exceptions I receive a compile time error
    package com.mysql.jdbc.exceptions does not exist!
    Anyone could help?
    Thanks for your attention
    By Manio

    Thankfully there is no reason for you to do this so it's really not a problem.
    You should ONLY be importing java.sql.* (and sometimes javax) but not specific driver packages.

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

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

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

  • "com.mysql.jdbc.PacketTooBigException": Help needed urgently

    hi,
    I am using mm.mysql j/connector ver 3.0.6 and MYSQL server version 4.0.
    Max_allowed packet= 8MB at the server side
    I am getting PacketTooBigException when i am trying to update a particular column.
    What should i do.
    Any help will be greatly appreciated!!!

    the driver uses a 64 k max packet size by default. it is supposed to change this as neccessary upon connection but perhaps that is failing?
    below is the 3.0.7 connection code that i have slightly modified for you so that it prints out the connection properties after they have been initialized so that you can see what they are.
    try it out and i hope you find this helpful.
       Copyright (C) 2002 MySQL AB
          This program is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 2 of the License, or
          (at your option) any later version.
          This program is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
          You should have received a copy of the GNU General Public License
          along with this program; if not, write to the Free Software
          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    /*Slight Modification by Max Stocker April 29, 2003 to trace what the connection values get initialized to. */
    package com.mysql.jdbc;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.Reader;
    import java.io.UnsupportedEncodingException;
    import java.math.BigDecimal;
    import java.net.URL;
    import java.sql.Clob;
    import java.sql.Date;
    import java.sql.ParameterMetaData;
    import java.sql.Ref;
    import java.sql.SQLException;
    import java.sql.Savepoint;
    import java.sql.Time;
    import java.sql.Timestamp;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.Properties;
    import java.util.StringTokenizer;
    import java.util.TimeZone;
    * A Connection represents a session with a specific database.  Within the
    * context of a Connection, SQL statements are executed and results are
    * returned.
    * <P>A Connection's database is able to provide information describing
    * its tables, its supported SQL grammar, its stored procedures, the
    * capabilities of this connection, etc.  This information is obtained
    * with the getMetaData method.
    * @see java.sql.Connection
    * @author Mark Matthews
    * @version $Id: Connection.java,v 1.31.2.19 2003/03/28 22:42:24 mmatthew Exp $
    public class Connection implements java.sql.Connection {
        // The command used to "ping" the database.
        // Newer versions of MySQL server have a ping() command,
        // but this works for everything
        private static final String PING_COMMAND = "SELECT 1";
         * Map mysql transaction isolation level name to
         * java.sql.Connection.TRANSACTION_XXX
        private static Map mapTransIsolationName2Value = null;
         * The mapping between MySQL charset names
         * and Java charset names.
         * Initialized by loadCharacterSetMapping()
        private static Map charsetMap;
         * Table of multi-byte charsets.
         * Initialized by loadCharacterSetMapping()
        private static Map multibyteCharsetsMap;
         * Default socket factory classname
        private static final String DEFAULT_SOCKET_FACTORY = StandardSocketFactory.class
            .getName();
        static {
            loadCharacterSetMapping();
            mapTransIsolationName2Value = new HashMap(8);
            mapTransIsolationName2Value.put("READ-UNCOMMITED",
                new Integer(TRANSACTION_READ_UNCOMMITTED));
              mapTransIsolationName2Value.put("READ-UNCOMMITTED",
                   new Integer(TRANSACTION_READ_UNCOMMITTED));
            mapTransIsolationName2Value.put("READ-COMMITTED",
                new Integer(TRANSACTION_READ_COMMITTED));
            mapTransIsolationName2Value.put("REPEATABLE-READ",
                new Integer(TRANSACTION_REPEATABLE_READ));
            mapTransIsolationName2Value.put("SERIALIZABLE",
                new Integer(TRANSACTION_SERIALIZABLE));
         * Internal DBMD to use for various database-version
         * specific features
        private DatabaseMetaData dbmd = null;
         * The list of host(s) to try and connect to
        private List hostList = null;
          * A map of statements that have had setMaxRows() called on them
         private Map statementsUsingMaxRows;
         * The I/O abstraction interface (network conn to
         * MySQL server
        private MysqlIO io = null;
         * Mutex
        private final Object mutex = new Object();
         * The driver instance that created us
        private NonRegisteringDriver myDriver;
         * The map of server variables that we retrieve
         * at connection init.
        private Map serverVariables = null;
         * Properties for this connection specified by user
        private Properties props = null;
         * The database we're currently using
         * (called Catalog in JDBC terms).
        private String database = null;
         * If we're doing unicode character conversions,
         * what encoding do we use?
        private String encoding = null;
         * The hostname we're connected to
        private String host = null;
         * The JDBC URL we're using
        private String myURL = null;
         * The password we used
        private String password = null;
         * Classname for socket factory
        private String socketFactoryClassName = null;
         * The user we're connected as
        private String user = null;
         * The timezone of the server
        private TimeZone serverTimezone = null;
         * Allow LOAD LOCAL INFILE (defaults to true)
        private boolean allowLoadLocalInfile = true;
         * Are we in autoCommit mode?
        private boolean autoCommit = true;
         * Should we capitalize mysql types
        private boolean capitalizeDBMDTypes = false;
         * Should we continue processing batch commands if
         * one fails. The JDBC spec allows either way, so
         * we let the user choose
        private boolean continueBatchOnError = true;
         * Should we do unicode character conversions?
        private boolean doUnicode = false;
         * Are we failed-over to a non-master host
        private boolean failedOver = false;
        /** Does the server suuport isolation levels? */
        private boolean hasIsolationLevels = false;
         * Does this version of MySQL support quoted identifiers?
        private boolean hasQuotedIdentifiers = false;
        // This is for the high availability :) routines
        private boolean highAvailability = false;
         * Has this connection been closed?
        private boolean isClosed = true;
         * Should we tell MySQL that we're an interactive client?
        private boolean isInteractiveClient = false;
         * Is the server configured to use lower-case
         * table names only?
        private boolean lowerCaseTableNames = false;
         * Has the max-rows setting been changed from
         * the default?
        private boolean maxRowsChanged = false;
         * Do we expose sensitive information in exception
         * and error messages?
        private boolean paranoid = false;
         * Should we do 'extra' sanity checks?
        private boolean pedantic = false;
         * Are we in read-only mode?
        private boolean readOnly = false;
        /** Do we relax the autoCommit semantics? (For enhydra, for example) */
        private boolean relaxAutoCommit = false;
         * Do we need to correct endpoint rounding errors
        private boolean strictFloatingPoint = false;
         * Do we check all keys for updatable result sets?
        private boolean strictUpdates = true;
        /** Are transactions supported by the MySQL server we are connected to? */
        private boolean transactionsSupported = false;
         * Has ANSI_QUOTES been enabled on the server?
        private boolean useAnsiQuotes = false;
         * Should we use compression?
        private boolean useCompression = false;
         * Can we use the "ping" command rather than a
         * query?
        private boolean useFastPing = false;
         * Should we tack on @hostname in DBMD.getTable/ColumnPrivileges()?
        private boolean useHostsInPrivileges = true;
         * Should we use SSL?
        private boolean useSSL = false;
         * Should we use stream lengths in prepared statements?
         * (true by default == JDBC compliant)
        private boolean useStreamLengthsInPrepStmts = true;
         * Should we use timezone information?
        private boolean useTimezone = false;
        /** Should we return PreparedStatements for UltraDev's stupid bug? */
        private boolean useUltraDevWorkAround = false;
        private double initialTimeout = 2.0D;
         * How many hosts are in the host list?
        private int hostListSize = 0;
         * isolation level
        private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
         * The largest packet we can send (changed
         * once we know what the server supports, we
         * get this at connection init).
        private int maxAllowedPacket = 65536;
        private int maxReconnects = 3;
         * The max rows that a result set can contain.
         * Defaults to -1, which according to the JDBC
         * spec means "all".
        private int maxRows = -1;
        private int netBufferLength = 16384;
         * The port number we're connected to
         * (defaults to 3306)
        private int port = 3306;
         * How many queries should we wait before we try to re-connect
         * to the master, when we are failing over to replicated hosts
         * Defaults to 50
        private int queriesBeforeRetryMaster = 50;
         * What should we set the socket timeout to?
        private int socketTimeout = 0; // infinite
         * When did the last query finish?
        private long lastQueryFinishedTime = 0;
         * When did the master fail?
        private long masterFailTimeMillis = 0L;
         * Number of queries we've issued since the master
         * failed
        private long queriesIssuedFailedOver = 0;
         * How many seconds should we wait before retrying to connect
         * to the master if failed over? We fall back when either
         * queriesBeforeRetryMaster or secondsBeforeRetryMaster is
         * reached.
        private long secondsBeforeRetryMaster = 30L;
         * The type map for UDTs (not implemented, but used by
         * some third-party vendors, most notably IBM WebSphere)
        private Map typeMap;
         * Ignore non-transactional table warning for rollback?
        private boolean ignoreNonTxTables = false;
         * Creates a connection to a MySQL Server.
         * @param host the hostname of the database server
         * @param port the port number the server is listening on
         * @param info a Properties[] list holding the user and password
         * @param database the database to connect to
         * @param url the URL of the connection
         * @param d the Driver instantation of the connection
         * @exception java.sql.SQLException if a database access error occurs
        Connection(String host, int port, Properties info, String database,
            String url, NonRegisteringDriver d) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { host, new Integer(port), info, database, url, d };
                Debug.methodCall(this, "constructor", args);
            this.serverVariables = new HashMap();
            hostList = new ArrayList();
            if (host == null) {
                this.host = "localhost";
                hostList.add(this.host);
            } else if (host.indexOf(",") != -1) {
                // multiple hosts separated by commas (failover)
                StringTokenizer hostTokenizer = new StringTokenizer(host, ",", false);
                while (hostTokenizer.hasMoreTokens()) {
                    hostList.add(hostTokenizer.nextToken().trim());
            } else {
                this.host = host;
                hostList.add(this.host);
            hostListSize = hostList.size();
            this.port = port;
            if (database == null) {
                throw new SQLException("Malformed URL '" + url + "'.", "S1000");
            this.database = database;
            this.myURL = url;
            this.myDriver = d;
            this.user = info.getProperty("user");
            this.password = info.getProperty("password");
            if ((this.user == null) || this.user.equals("")) {
                this.user = "nobody";
            if (this.password == null) {
                this.password = "";
            this.props = info;
            initializeDriverProperties(info);
            if (Driver.DEBUG) {
                System.out.println("Connect: " + this.user + " to " + this.database);
            try {
                createNewIO(false);
                this.dbmd = new DatabaseMetaData(this, this.database);
            } catch (java.sql.SQLException ex) {
                cleanup();
                // don't clobber SQL exceptions
                throw ex;
            } catch (Exception ex) {
                cleanup();
                StringBuffer mesg = new StringBuffer();
                if (!useParanoidErrorMessages()) {
                    mesg.append("Cannot connect to MySQL server on ");
                    mesg.append(this.host);
                    mesg.append(":");
                    mesg.append(this.port);
                    mesg.append(".\n\n");
                    mesg.append("Make sure that there is a MySQL server ");
                    mesg.append("running on the machine/port you are trying ");
                    mesg.append(
                        "to connect to and that the machine this software is "
                        + "running on ");
                    mesg.append("is able to connect to this host/port "
                        + "(i.e. not firewalled). ");
                    mesg.append(
                        "Also make sure that the server has not been started "
                        + "with the --skip-networking ");
                    mesg.append("flag.\n\n");
                } else {
                    mesg.append("Unable to connect to database.");
                mesg.append("Underlying exception: \n\n");
                mesg.append(ex.getClass().getName());
                throw new java.sql.SQLException(mesg.toString(), "08S01");
         * If a connection is in auto-commit mode, than all its SQL
         * statements will be executed and committed as individual
         * transactions.  Otherwise, its SQL statements are grouped
         * into transactions that are terminated by either commit()
         * or rollback().  By default, new connections are in auto-
         * commit mode.  The commit occurs when the statement completes
         * or the next execute occurs, whichever comes first.  In the
         * case of statements returning a ResultSet, the statement
         * completes when the last row of the ResultSet has been retrieved
         * or the ResultSet has been closed.  In advanced cases, a single
         * statement may return multiple results as well as output parameter
         * values.  Here the commit occurs when all results and output param
         * values have been retrieved.
         * <p><b>Note:</b> MySQL does not support transactions, so this
         *                 method is a no-op.
         * @param autoCommit - true enables auto-commit; false disables it
         * @exception java.sql.SQLException if a database access error occurs
        public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Boolean(autoCommit) };
                Debug.methodCall(this, "setAutoCommit", args);
            checkClosed();
            if (this.transactionsSupported) {
                // this internal value must be set first as failover depends on it
                // being set to true to fail over (which is done by most
                // app servers and connection pools at the end of
                // a transaction), and the driver issues an implicit set
                // based on this value when it (re)-connects to a server
                // so the value holds across connections
                this.autoCommit = autoCommit;
                String sql = "SET autocommit=" + (autoCommit ? "1" : "0");
                execSQL(sql, -1, this.database);
            } else {
                if ((autoCommit == false) && (this.relaxAutoCommit == false)) {
                    throw new SQLException("MySQL Versions Older than 3.23.15 "
                        + "do not support transactions", "08003");
                } else {
                    this.autoCommit = autoCommit;
            return;
         * gets the current auto-commit state
         * @return Current state of the auto-commit mode
         * @exception java.sql.SQLException (why?)
         * @see setAutoCommit
        public boolean getAutoCommit() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getAutoCommit", args);
                Debug.returnValue(this, "getAutoCommit",
                    new Boolean(this.autoCommit));
            return this.autoCommit;
         * A sub-space of this Connection's database may be selected by
         * setting a catalog name.  If the driver does not support catalogs,
         * it will silently ignore this request
         * <p><b>Note:</b> MySQL's notion of catalogs are individual databases.
         * @param catalog the database for this connection to use
         * @throws java.sql.SQLException if a database access error occurs
        public void setCatalog(String catalog) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { catalog };
                Debug.methodCall(this, "setCatalog", args);
            checkClosed();
            String quotedId = this.dbmd.getIdentifierQuoteString();
            if ((quotedId == null) || quotedId.equals(" ")) {
                quotedId = "";
            StringBuffer query = new StringBuffer("USE ");
            query.append(quotedId);
            query.append(catalog);
            query.append(quotedId);
            execSQL(query.toString(), -1, catalog);
            this.database = catalog;
         * Return the connections current catalog name, or null if no
         * catalog name is set, or we dont support catalogs.
         * <p><b>Note:</b> MySQL's notion of catalogs are individual databases.
         * @return the current catalog name or null
         * @exception java.sql.SQLException if a database access error occurs
        public String getCatalog() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getCatalog", args);
                Debug.returnValue(this, "getCatalog", this.database);
            return this.database;
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public boolean isClosed() {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "isClosed", args);
                Debug.returnValue(this, "isClosed", new Boolean(this.isClosed));
            return this.isClosed;
         * Returns the character encoding for this Connection
         * @return the character encoding for this connection.
        public String getEncoding() {
            return this.encoding;
         * @see Connection#setHoldability(int)
        public void setHoldability(int arg0) throws SQLException {
            // do nothing
         * @see Connection#getHoldability()
        public int getHoldability() throws SQLException {
            return ResultSet.CLOSE_CURSORS_AT_COMMIT;
         * NOT JDBC-Compliant, but clients can use this method
         * to determine how long this connection has been idle.
         * This time (reported in milliseconds) is updated once
         * a query has completed.
         * @return number of ms that this connection has
         * been idle, 0 if the driver is busy retrieving results.
        public long getIdleFor() {
            if (this.lastQueryFinishedTime == 0) {
                return 0;
            } else {
                long now = System.currentTimeMillis();
                long idleTime = now - this.lastQueryFinishedTime;
                return idleTime;
         * Should we tell MySQL that we're an interactive client
         * @return true if isInteractiveClient was set to true.
        public boolean isInteractiveClient() {
            return isInteractiveClient;
         * A connection's database is able to provide information describing
         * its tables, its supported SQL grammar, its stored procedures, the
         * capabilities of this connection, etc.  This information is made
         * available through a DatabaseMetaData object.
         * @return a DatabaseMetaData object for this connection
         * @exception java.sql.SQLException if a database access error occurs
        public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException {
            checkClosed();
            return new DatabaseMetaData(this, this.database);
         * You can put a connection in read-only mode as a hint to enable
         * database optimizations
         * <B>Note:</B> setReadOnly cannot be called while in the middle
         * of a transaction
         * @param readOnly - true enables read-only mode; false disables it
         * @exception java.sql.SQLException if a database access error occurs
        public void setReadOnly(boolean readOnly) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Boolean(readOnly) };
                Debug.methodCall(this, "setReadOnly", args);
                Debug.returnValue(this, "setReadOnly", new Boolean(readOnly));
            checkClosed();
            this.readOnly = readOnly;
         * Tests to see if the connection is in Read Only Mode.  Note that
         * we cannot really put the database in read only mode, but we pretend
         * we can by returning the value of the readOnly flag
         * @return true if the connection is read only
         * @exception java.sql.SQLException if a database access error occurs
        public boolean isReadOnly() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "isReadOnly", args);
                Debug.returnValue(this, "isReadOnly", new Boolean(this.readOnly));
            return this.readOnly;
         * @see Connection#setSavepoint()
        public java.sql.Savepoint setSavepoint() throws SQLException {
            throw new NotImplemented();
         * @see Connection#setSavepoint(String)
        public java.sql.Savepoint setSavepoint(String arg0)
            throws SQLException {
            throw new NotImplemented();
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public TimeZone getServerTimezone() {
            return this.serverTimezone;
         * DOCUMENT ME!
         * @param level DOCUMENT ME!
         * @throws java.sql.SQLException DOCUMENT ME!
        public void setTransactionIsolation(int level) throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = { new Integer(level) };
                Debug.methodCall(this, "setTransactionIsolation", args);
            checkClosed();
            if (this.hasIsolationLevels) {
                StringBuffer sql = new StringBuffer(
                        "SET SESSION TRANSACTION ISOLATION LEVEL ");
                switch (level) {
                case java.sql.Connection.TRANSACTION_NONE:
                    throw new SQLException("Transaction isolation level "
                        + "NONE not supported by MySQL");
                case java.sql.Connection.TRANSACTION_READ_COMMITTED:
                    sql.append("READ COMMITTED");
                    break;
                case java.sql.Connection.TRANSACTION_READ_UNCOMMITTED:
                    sql.append("READ UNCOMMITTED");
                    break;
                case java.sql.Connection.TRANSACTION_REPEATABLE_READ:
                    sql.append("REPEATABLE READ");
                    break;
                case java.sql.Connection.TRANSACTION_SERIALIZABLE:
                    sql.append("SERIALIZABLE");
                    break;
                default:
                    throw new SQLException("Unsupported transaction "
                        + "isolation level '" + level + "'", "S1C00");
                execSQL(sql.toString(), -1, this.database);
                isolationLevel = level;
            } else {
                throw new java.sql.SQLException("Transaction Isolation Levels are "
                    + "not supported on MySQL versions older than 3.23.36.", "S1C00");
         * Get this Connection's current transaction isolation mode.
         * @return the current TRANSACTION_* mode value
         * @exception java.sql.SQLException if a database access error occurs
        public int getTransactionIsolation() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getTransactionIsolation", args);
                Debug.returnValue(this, "getTransactionIsolation",
                    new Integer(isolationLevel));
            if (this.hasIsolationLevels) {
                 java.sql.Statement stmt = null;
                 java.sql.ResultSet rs = null;
                 try {
                      stmt = this.createStatement();
                      String query = null;
                      if (this.io.versionMeetsMinimum(4, 0, 3)) {
                           query = "SHOW VARIABLES LIKE 'tx_isolation'";
                      } else {
                           query = "SHOW VARIABLES LIKE 'transaction_isolation'";
                      rs = stmt.executeQuery(query);
                      if (rs.next()) {
                           String s = rs.getString(2);
                           if (s != null) {
                                  Integer intTI = (Integer) mapTransIsolationName2Value.get(s);
                                  if (intTI != null) {
                                       return intTI.intValue();
                           throw new SQLException("Could not map transaction isolation '" + s + " to a valid JDBC level.", "S1000");
                      } else {
                           throw new SQLException("Could not retrieve transaction isolation level from server", "S1000");
                 } finally {
                      if (rs != null) {
                           try {
                                rs.close();
                           } catch (Exception ex) {
                                // ignore
                           rs = null;
                      if (stmt != null) {
                           try {
                                stmt.close();
                           } catch (Exception ex) {
                                // ignore
                           stmt = null;
            return isolationLevel;
         * JDBC 2.0
         * Install a type-map object as the default type-map for
         * this connection
         * @param map the type mapping
         * @throws SQLException if a database error occurs.
        public void setTypeMap(java.util.Map map) throws SQLException {
            this.typeMap = map;
         * JDBC 2.0
         * Get the type-map object associated with this connection.
         * By default, the map returned is empty.
         * @return the type map
         * @throws SQLException if a database error occurs
        public synchronized java.util.Map getTypeMap() throws SQLException {
            if (this.typeMap == null) {
                this.typeMap = new HashMap();
            return this.typeMap;
         * The first warning reported by calls on this Connection is
         * returned.
         * <B>Note:</B> Sebsequent warnings will be changed to this
         * java.sql.SQLWarning
         * @return the first java.sql.SQLWarning or null
         * @exception java.sql.SQLException if a database access error occurs
        public java.sql.SQLWarning getWarnings() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "getWarnings", args);
                Debug.returnValue(this, "getWarnings", null);
            return null;
         * Allow use of LOAD LOCAL INFILE?
         * @return true if allowLoadLocalInfile was set to true.
        public boolean allowLoadLocalInfile() {
            return this.allowLoadLocalInfile;
         * DOCUMENT ME!
         * @return DOCUMENT ME!
        public boolean capitalizeDBMDTypes() {
            return this.capitalizeDBMDTypes;
         * After this call, getWarnings returns null until a new warning
         * is reported for this connection.
         * @exception java.sql.SQLException if a database access error occurs
        public void clearWarnings() throws java.sql.SQLException {
            if (Driver.TRACE) {
                Object[] args = new Object[0];
                Debug.methodCall(this, "clearWarnings", args);
            // firstWarning = null;
         * In some cases, it is desirable to immediately release a Connection's
         * database and JDBC resources instead of waiting for them to be
         * automatically released (                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

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

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

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

  • Com.mysql.jdbc.JDBC4Connection suspected memory leak in java

    We have a java application where we are using Bonecp pooling library. Below is how we setup the pooling.
    [code]
    try {
       // setup the connection pool
       BoneCPConfig config = new BoneCPConfig();
      config.setJdbcUrl("jdbc:mysql://**.**.**.**:3306/test1");  config.setUsername("******");
      config.setPassword("*******");  config.setMinConnectionsPerPartition(5);
      config.setMaxConnectionsPerPartition(40);
      config.setPartitionCount(1);
      connectionPool = new BoneCP(config); // setup the connection pool 
       catch (SQLException e) {
      e.printStackTrace(System.out);
    [/code]
    Then for insert and update queries we do this and below we make sure closed the statement.
    [code]
    Statement stmt1 = null;
    stmt1 = dbconn.createStatement();
    String insertQuery3 =........
    count = stmt9.executeUpdate(insertQuery3);
    try{
       if ( stmt1!= null ){  stmt1.close();
       else{
       System.out.println("No stm1 exist");
    }catch(SQLException ex){   System.out.println("SQLException has been caught for stmt1");
    ex.printStackTrace(System.out);
    For select we do this 
    Statement stmt2 = null;
    stmt2 = dbconn.createStatement();
    String selectQuery2= .........
    ResultSet rs2 = stmt2.executeQuery(selectQuery2);
    if(rs2.next())
    try{
       if ( rs2!= null ){  rs2.close();
       }   else{
       System.out.println("No rs2 exist");
       if ( stmt2!= null ){  stmt2.close();
       }   else{
       System.out.println("No stm2 exist");
    }catch(SQLException ex){   System.out.println("SQLException has been caught for stmt2");
    ex.printStackTrace(System.out);
    [/code]
    Thus we have ensured that every resultset and statement is closed immediately after its use. The problem now when we took few sample from MAT is show increasing memory usage as below.
    Sample 1
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 11,793,200 (76.19%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 958,096 (6.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 875,568 (5.66%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 816,048 (5.27%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 754,016 (4.87%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 727,024 (4.70%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 663,872 (4.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 618,200 (3.99%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 616,608 (3.98%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 612,544 (3.96%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 598,400 (3.87%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 584,992 (3.78%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 561,224 (3.63%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 531,816 (3.44%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 531,416 (3.43%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 522,184 (3.37%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 482,992 (3.12%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 453,256 (2.93%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 424,656 (2.74%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 187,008 (1.21%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report2060944296830228239/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]
    Sample 2
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 13,827,392 (78.27%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 1,093,888 (6.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 957,888 (5.42%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 916,672 (5.19%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 878,392 (4.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 841,136 (4.76%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 758,336 (4.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 747,240 (4.23%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 735,712 (4.16%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 700,912 (3.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 681,336 (3.86%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 668,080 (3.78%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 658,816 (3.73%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 638,208 (3.61%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 605,376 (3.43%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 582,104 (3.29%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 558,344 (3.16%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 523,952 (2.97%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 508,232 (2.88%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf1603618 - 276,944 (1.57%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 275,288 (1.56%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf148fd70 - 220,536 (1.25%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report8548522855535006676/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]
    Sample 3
    [code]
    21 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0" occupy 17,339,632 (80.79%) bytes.
    Biggest instances:
    com.mysql.jdbc.JDBC4Connection @ 0xf016d728 - 1,228,048 (5.72%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0094478 - 1,144,056 (5.33%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0201ba0 - 1,126,120 (5.25%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ab3f0 - 1,074,552 (5.01%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf006ee40 - 993,912 (4.63%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0076a90 - 931,512 (4.34%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf015fcf0 - 930,952 (4.34%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04ad490 - 918,176 (4.28%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00bea28 - 874,512 (4.07%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0467bc0 - 846,368 (3.94%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf00b7bd0 - 838,448 (3.91%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf021c830 - 799,184 (3.72%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf0097818 - 791,256 (3.69%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01a27c0 - 763,264 (3.56%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf01c2d80 - 745,088 (3.47%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf012b158 - 710,704 (3.31%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf04693e0 - 704,072 (3.28%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf147f438 - 680,400 (3.17%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf1603618 - 458,472 (2.14%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf148fd70 - 390,984 (1.82%) bytes.
    com.mysql.jdbc.JDBC4Connection @ 0xf15ff7d0 - 389,552 (1.82%) bytes.
    Keywords
    com.mysql.jdbc.JDBC4Connection
    sun.misc.Launcher$ExtClassLoader @ 0xf000a4f0
    file:///C:/Documents%20and%20Settings/ss/Local%20Settings/Temp/report3656754586920669017/pages/18.html# Reference Pattern
    Class Name
    Shallow Heap
    Retained Heap
    Percentage
    class java.lang.Thread @ 0xf0003840
    40
    208
    0.00%
    [/code]

    Dear Masijade,
                          Actually I was confuse with where to put and not to put the try and catch. Below is how my skeleton of my codes will be looking like. I just put one sample query there. If you notice at the very end finally I already have even now dbconn.close(); which closes the pooling connection. The problem  I am worried now is that incase there is any exception how will it be rollbacked. Because if you notice now I lump all the queries under one big try and catch but with your suggestion I have to do try and catch for each query right?
    [code]
    BoneCP connectionPool = null;
      class ConnectionHandler implements Runnable {
        private Socket receivedSocketConn1;
        ConnectionHandler(Socket receivedSocketConn1) {
          this.receivedSocketConn1=receivedSocketConn1;
        Connection dbconn = null;
        public void run() { // etc
         BufferedWriter writeBuffer = null;
         BufferedReader readBuffer = null;
         String capturedMessage="";
         try{
            dbconn = connectionPool.getConnection();
            dbconn.setAutoCommit(false);
            while ((nextChar=readBuffer.read()) != -1){          
              capturedMessage += (char) nextChar;
              if (nextChar == '*')
               try{
                    //all queries here.
                    try{            
                        Statement stmt1 = null;
                        stmt1 = dbconn.createStatement();
                        try{
                          String updateCommand1 = //query
                          count = stmt1.executeUpdate(updateCommand1);
                        finally{
                          if( stmt1 != null ){
                           stmt1.close();
                        else{
                        System.out.println("stmt1 is null in finally close");
                   catch(SQLException ex){
                     ex.printStackTrace(System.out);
                   dbconn.commit
               catch (SQLException ex){
                    ex.printStackTrace(System.out);
                    try{  
                  dbconn.rollback();
               catch (Exception rollback){  
                  rollback.printStackTrace(System.out);
           catch (Exception e){
               e.printStackTrace(System.out);
               try{  
                  dbconn.rollback();
               catch (Exception rollback){  
                  rollback.printStackTrace(System.out);
           finally
         catch (SocketTimeoutException ex){
               ex.printStackTrace();
         catch (IOException ex){
               ex.printStackTrace();
         catch (Exception ex){
               ex.printStackTrace(System.out);
          finally{
            try{
             if ( dbconn != null ){
               dbconn.close();
             else{
              System.out.println("dbConn is null in finally close");
            catch(SQLException ex){
                ex.printStackTrace();
            try{
              if ( writeBuffer != null ){
                writeBuffer.close();
             else{
              System.out.println("w is null in finally close");
            catch(IOException ex){
                ex.printStackTrace(System.out);
    [/code]

  • Java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)

    Hi,All
    Need Help regarding the exception.
    As i tried so many way to solve this problem but cound'nt find out the solution.!!! If i restart the server then this error is resolved but for the some time.,after 4-5 hour again i need to restart the server.
    so please help me out from this problem!!!!!!
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: #{cityf.OrderToConsumerCity}: javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:225)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    javax.faces.FacesException: #{cityf.OrderToConsumerCity}: javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    org.hibernate.exception.JDBCConnectionException: could not execute query
         org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
         org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         org.hibernate.loader.Loader.doList(Loader.java:2223)
         org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         org.hibernate.loader.Loader.list(Loader.java:2099)
         org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         com.etelic.dao.ConsumerDAOHibernate.getCityList(ConsumerDAOHibernate.java:153)
         com.etelic.controller.City.OrderToConsumerCity(City.java:286)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         java.lang.reflect.Method.invoke(Unknown Source)
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:
    ** BEGIN NESTED EXCEPTION **
    com.mysql.jdbc.CommunicationsException
    MESSAGE: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 15 ms ago.
    STACKTRACE:
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    *java.io.EOFException*
    *     at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)*     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 15 ms ago.
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2579)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
         com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
         com.mysql.jdbc.Connection.checkClosed(Connection.java:1931)
         com.mysql.jdbc.Connection.prepareStatement(Connection.java:4720)
         com.mysql.jdbc.Connection.prepareStatement(Connection.java:4686)
         org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
         org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
         org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
         org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
         org.hibernate.loader.Loader.doQuery(Loader.java:673)
         org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         org.hibernate.loader.Loader.doList(Loader.java:2220)
         org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         org.hibernate.loader.Loader.list(Loader.java:2099)
         org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         com.etelic.dao.ConsumerDAOHibernate.getCityList(ConsumerDAOHibernate.java:153)
         com.etelic.controller.City.OrderToConsumerCity(City.java:286)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         java.lang.reflect.Method.invoke(Unknown Source)
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
    Apache Tomcat/6.0.14-Thanks and regards
    Praveen Soni

    Hey BalusC
    As i already obtain a new session object from sessionfactory,for one or more transactions at once(!),
    For reference see below code:
    package com.dao>hibenateUtil;
    import java.util.*;
    import com.ConsumerRecord;
    public class ConsumerDAOHibernate implements IConsumerDAO {
         public Long getNumberMatchingQuery(ConsumerRecord upr){
             String query = new String();
            String queryStart = "select count(*) FROM person in CLASS com.ConsumerRecord";
            query += queryStart;
            org.hibernate.Query q = HibernateUtil.getSession().createQuery(query);
            return (Long)q.uniqueResult();
        public Long getNumberMatchingCity(ConsumerRecord upr){
             String query = new String();
            String queryStart = "select count(*) FROM city in CLASS com.ConsumerRecord";
            query += queryStart;
            org.hibernate.Query q = HibernateUtil.getSession().createQuery(query);
            return (Long)q.uniqueResult();
    Hibernate Util:-package com.dao;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import org.apache.log4j.Logger;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    public class HibernateUtil {
        private static final SessionFactory sessionFactory;
        private static Session  session = null;
        private static Logger logger = Logger.getLogger(HibernateUtil.class.getName());
        static {
            try {
                /** TODO: change to IOC w/ datasource */
                Configuration conf = new Configuration();
                sessionFactory = conf.configure().buildSessionFactory();
            } catch (Throwable ex) {
                // Make sure you log the exception, as it might be swallowed
                System.err.println("Initial SessionFactory creation failed." + ex);
                throw new ExceptionInInitializerError(ex);
        public static Session getSession() {
            if(session == null){
                try {
                    session = sessionFactory.openSession();   
                    logger.debug("****************************new session being created**************************************");
                               //sessionFactory.
                } catch (Throwable ex) {
                    // Make sure you log the exception, as it might be swallowed
                    System.err.println("Initial SessionFactory creation failed." + ex);
                    throw new ExceptionInInitializerError(ex);
            return session;
        }

Maybe you are looking for

  • Technical Systems and Business Systems

    Hello Everybody!!! I have some doubts, can you help me, please??? 1) Technical Systems are application(software) systems, ok? They aren't hardware systems, ok? 2) In my SLD I should have a SAP ECC system as a technical system and each of their client

  • ITunes new version 7.0.1.8 freezes when burning

    Ever since I got the new iTunes 7, I can't burn my playlists to CDs. When I'm in my playlist, I click Burn Disc on the bottom right. Then it tells me to insert a blank disc, which I do. After the disc is in, the display says that it's "Checking Playl

  • I want to download adobe flash using safari on my I pad. Free download please.

    Hi I would like to download adobe flash on my I pad

  • CJI3 - Total Value in Transaction Currency values not Appearing

    Hi experts, We have a question regarding the CJI3 transaction. We open a project in CJI3 and view all its postings. From the report we observe two columns: Total Value in Controlling Area Currency and Total Value in Transaction Currency columns. Thes

  • Envelopes on C6380 - Paper miss match

    Hi, I am trying to print an envelope from Microsoft word with the Photosmart C6380. I load the envelope into the main paper try and start printing... once the printer has pulled the envelope half way in an error message shows up on the screen saying