Java.sql.SQLException: Cannot rollback a transactional connection

Hi
This is what i am trying to do:
try{
conn = getConnection();
conn.setAutoCommit(false);
execQuery(sql_1);
execQuery(sql_2);
conn.commit();
}catch(Exception ex){
conn.rollback();
i have made an error in sql_2 so i get an Exception. My queries use the same "conn" so the rollback should applay to the first query but it has made a commit. How do i get rollback to work?
I read this in an other topic:
Make sure that you configure your database connection in the jboss.jcml and not in the bean (or servlet) itself.
Then, make a lookup via jndi. On this way, the driver gets bound to the transactionManager and the rollback() works finde.
But i don�t know how to configure the connections, and how does the trasactionManager work.
Can some one help me?

Maybe i should ad that i am using Oracle db an the
code is in a Entity BeanThis changes the way you want to do rollbacks. Rollbacks in ejbs are handled by the container. In order to do rollbacks, you need to flag the transaction as to be rolled back. To do this, you need to call the method setRollbackOnly() in the ejb's SessionContext - sessionContext.setRollbackOnly();
For this to work correctly, you must declare the method in the ejb's deployment descriptor as requiring to handle transactions by specifying the appropriate value for the <tran-attribute> element of you ejb's dd.
BTW, you'd be better off posting EJB related question in the J2EE SDK forum.

Similar Messages

  • Java.sql.SQLException: Cannot call rollback when using distributed transac

    Hi all,
    I am getting the below exception trace when I tried to rollback the data in WLI.I am getting the db connection Object from DBControl.
    java.sql.SQLException: Cannot call rollback when using distributed transactions
    at weblogic.jdbc.wrapper.JTAConnection.rollback(JTAConnection.java:313)
    at controls.DailyFeedFileJavaImpl.excuteBatch(DailyFeedFileJavaImpl.jcs:
    904)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:381)
    at $Proxy59.excuteBatch(Unknown Source)
    at QnbDailyFeedProcess.feedFileJavaObjExcuteBatch(QnbDailyFeedProcess.jp
    d:274)
    at QnbDailyFeedProcess_wf$ImplControlSend15.invoke(QnbDailyFeedProcess_w
    f.java:146)
    at com.bea.wli.bpm.runtime.Perform.execute(Perform.java:32)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:726)
    at QnbDailyFeedProcess_wf$_ProcessState.executeInternalCallback(QnbDaily
    FeedProcess_wf.java:311)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:685)
    at com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration(Process
    State.java:681)
    at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wli.bpm.runtime.JpdInternalDispMethod.invoke(JpdInternalDispM
    ethod.java:87)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:24

    shanmuga gomathi nayagam wrote:
    Hi all,
    I am getting the below exception trace when I tried to rollback the data in WLI.I am getting the db connection Object from DBControl.
    java.sql.SQLException: Cannot call rollback when using distributed transactions
    at weblogic.jdbc.wrapper.JTAConnection.rollback(JTAConnection.java:313)Hi, Ideally, you should obtain the Transaction object and roll it back/ set it
    to rollback only.
    Joe
    at controls.DailyFeedFileJavaImpl.excuteBatch(DailyFeedFileJavaImpl.jcs:
    904)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:381)
    at $Proxy59.excuteBatch(Unknown Source)
    at QnbDailyFeedProcess.feedFileJavaObjExcuteBatch(QnbDailyFeedProcess.jp
    d:274)
    at QnbDailyFeedProcess_wf$ImplControlSend15.invoke(QnbDailyFeedProcess_w
    f.java:146)
    at com.bea.wli.bpm.runtime.Perform.execute(Perform.java:32)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:726)
    at QnbDailyFeedProcess_wf$_ProcessState.executeInternalCallback(QnbDaily
    FeedProcess_wf.java:311)
    at com.bea.wli.bpm.runtime.ProcessState.executeInternalCallback(ProcessS
    tate.java:685)
    at com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration(Process
    State.java:681)
    at sun.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
    :371)
    at com.bea.wli.bpm.runtime.JpdInternalDispMethod.invoke(JpdInternalDispM
    ethod.java:87)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
    3)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
    6)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:24

  • Java.sql.SQLException: Cannot obtain connection after 3600 seconds. , Exception = Access not allowed

    Using Weblogic Platform 7.0 (installed from platform700_win32.exe),
    Running a BPM Doamin(WLIDomain with BPM only).
    When I try to access my entity bean(CMP), the following exception is getting thrown.
    I have seen a similar post in here, but the answer to that post, which says to
    provide ACL. does not apply quite well my scenario.
    To do this, I right clicked on the connection pool and selected define Ploicy..
    It shows two options
    RealmAdapterAuthorizer and DefaultAuthorizer; On DefaultAuthroizer i specified
    role accessing the resource would be "everyone". - restarted the server - but
    still the same error.
    Please suggest a solution if any. Do i have to get some service pack for this?
    TIA
    Ranjith.

    We have never seen a case yet where this was not a permissions problem.
    Do you have a fileRealm.properties file as part of your configuration?
    "Ranjith" <[email protected]> wrote in message
    news:3f0fdeb3$[email protected]..
    >
    java.sql.SQLException: Cannot obtain connection after 3600 seconds. ,Exception
    = Access not allowed
    java.sql.SQLException: Cannot obtain connection after 3600 seconds. ,Exception
    = Access not allowed
    atweblogic.jdbc.jts.Connection.wrapAndThrowSQLException(Connection.java:701)
    atweblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:623)
    atweblogic.jdbc.jts.Connection.prepareStatement(Connection.java:133)
    atweblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.ja
    va:139)
    atweblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:81
    atservice.samplemgt.v1_0.ejb.entity.BanksampletypeCMP_ckv0ao__WebLogic_CMP_RDB
    MS.ej
    bFindAll(BanksampletypeCMP_ckv0ao__WebLogic_CMP_RDBMS.java:873)
    at java.lang.reflect.Method.invoke(Native Method)
    atweblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMSPersi
    stenceManager
    java:300)
    atweblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityManager.
    java:715)
    atweblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityManager.
    java:688)
    atweblogic.ejb20.internal.EntityEJBLocalHome.finder(EntityEJBLocalHome.java:47
    6)
    at ...

  • Java.sql.SQLException: Cannot disable AUTO_COMMIT

    Hi,
    I am getting "java.sql.SQLException: Cannot disable AUTO_COMMIT" exception when using mySQL
    with Weblogic 5.1 EJB (through org.gjt.mm.mysql.Driver JDBC driver).
    Can anybody help!!!!!!
    Thank you, Eric
    [email protected]

    eric wrote:
    >
    Hi,
    I am getting "java.sql.SQLException: Cannot disable AUTO_COMMIT" exception when using mySQL
    with Weblogic 5.1 EJB (through org.gjt.mm.mysql.Driver JDBC driver).Hi. I'd have to see the whole stack trace to know for sure, but it looks like the
    DBMS/driver you're using doesn't implement the transactional calls/behavior that
    are required for managing EJB transactions. If you can write a small standalone
    java program that just gets a JDBC connection to your database, then calls setAutoCommit(false),
    then does a few updates, then calls Conenction.commit(), then there may be a weblogic problem,
    but if your simple program gets the same error, you need a transactionally capable DBMS.
    Joe
    Can anybody help!!!!!!
    Thank you, Eric
    [email protected]

  • Java.sql.SQLException: Cannot load JDBC driver class 'null'

    Hi,
    I am a beginner of using jdbc, i use the tomcat4.1.x, mysql3.23.54 and it's jdbc driver 2.0.14. I place the drive <in jar file> in tomcat/commons/lib and configure the server.xml, web.xml and some testing coding. But there are some error like the following:
    java.sql.SQLException: Cannot load JDBC driver class 'null'
         at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
         at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
         at foo.DBTest.init(DBTest.java:18)
         at org.apache.jsp.test_jsp._jspService(test_jsp.java:48)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
    of course its some of the error code and there are more.
    Why I have this problems and how can I fix it? Can someone help me??
    Thanks,
    Tong
    I place my test.jsp at tomcat/webapps/DBTest and DBTest.java at tomcat/webapps/DBTest/WEB-INF/classes/foo
    additional of the tomcat/conf/server.xml
    <Resource name="TestDB" auth="Container" type="javax.sql.DataSource" description="MySQL TestDB"/>
    <ResourceParams name="TestDB">
    <parameter><name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter><name>maxActive</name><value>10</value></parameter>
    <parameter><name>maxIdle</name><value>1</value></parameter>
    <parameter><name>maxWait</name><value>10000</value></parameter>
    <parameter><name>username</name><value>javauser</value></parameter>
    <parameter><name>password</name><value>javadude</value></parameter>
    <parameter>
    <name>driverClassName</name>
    <value>org.gjt.mm.mysql.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    tomcat/webapps/DBTest/WEB-INF/web.xml :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>MySQL Test App</description>
    </web-app>

    Post the part of your code that loads the driver and connects. My guess is you are using a variable for the name of the driver and the variable has not been set to anything(intially set to null).
    Thanks
    Cardwell

  • Java.sql.SQLException: Cannot load JDBC driver

    THis topic has been discussed many many times but I still not able to connect to Oracle 8i from my servlet using Tomcat 4.1.12 on hp-ux and java1.3
    I always got: java.sql.SQLException: Cannot load JDBC driver class 'null'
    In server.xml:
    <Context Path="/MyApp" docBase="MyApp" debug="0" reloadable="true" >
    <Resource name="jdbc/ora" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/ora" >
    <parameter>
    <name>username</name>
    <value>myname</value>
    </parameter>
    <parameter> <name>password</name>
    <value>mypassword</value>
    </parameter>
    <parameter> <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:oracle:thin:@myhostname:1521:ora</value>
    </parameter> </ResourceParams>
    </Context>
    In MyApp/WEB-INF/web.xml:
    <resource-ref>
    <res-ref-name>jdbc/ora</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    The Oracle jdbc jar file classes12.jar is under common/lib in Tomcat's home. read Permission is there.
    In the servlet:
    init(ServletConfig config):
    Context init = new InitialContext();
    Context ctx = (Context) init.lookup("java:comp/env");
    dataSource = (DataSource) ctx.lookup("jdbc/acdb");
    doPost(..)
    the error occured at :
    synchronized (dataSource){
    con = dataSource.getConnection();}
    Thanks in advance!

    Everything looks correct to me, except for one thing.
    In your web.xml you have this:
    <res-ref-name>jdbc/ora</res-ref-name> In your server.xml, you have this tag, which matches your web.xml:
    <ResourceParams name="jdbc/ora" > But in your Java code, you've got this:
    dataSource = (DataSource) ctx.lookup("jdbc/acdb"); When I've successfully set up a Web app data source, all three names had to agree. You either need to change your Java lookup name to "jdbc/ora" or change the web.xml and server.xml to "jdbc/acdb".
    See if that does it. Everything else sounds correct to me. - MOD

  • Java.sql.SQLException: No operations allowed after connection closed

    Hi all
    I was trying the jakarta DBCP pool for managing my connections to Mysql(4.0.17-standard ). I let tomcat to manage the pool by specifying datasource in server.xml and web.xml. Everything works fine if there are only a few transactions. But when the number of queries increse, I get an exception like
    java.sql.SQLException: No operations allowed after connection closed.
    Connection was closed explicitly by the application at the following location:
    ** BEGIN NESTED EXCEPTION **
    java.lang.Throwable
    STACKTRACE:
    java.lang.Throwable
            at com.mysql.jdbc.Connection.close(Connection.java:1061)
            at org.apache.commons.dbcp.PoolableConnection.reallyClose(PoolableConnec
    tion.java:124)
            at org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(Poola
    bleConnectionFactory.java:196)
            at org.apache.commons.pool.impl.GenericObjectPool.returnObject(Unknown S
    ource)
            at org.apache.commons.dbcp.AbandonedObjectPool.returnObject(AbandonedObj
    ectPool.java:140)
            at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.j
    ava:110)
    ......I then tried the Connecion Pool manually with DBCP to check it is a problm with tomcat or ont. Still the exception comes after a few transactions. I re-checked the code and I am closing all connections in finally block. I searched in net for a solution, but couldnt find any. Is that a problm with mysql? has anyone experienced it? Any help will be greatly appreciated
    thanks
    boolee

    Odd that Throwable is the exception logged. What does your finally block actually look like? As an experiment, what happens if you execute the following line of hypothetical code in your 'finally' block?
    finally {
      System.out.println(conn.getClass().getName());
    }- Saish

  • Java.sql.SQLException: Error in allocating a connection. Cause: No Password

    I'm deploying an EJB Module with a CMP in SJAS from SJSE.
    I get the following exception "java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found" the first time a CMP tries to connect to the MS SQL Server database.
    I can connect through the Admin console (PING works fine) but this error hapens in runtime.
    The datasource classname i'm using is "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource" which is suggested by the SJSE.
    Any help will be welcome...
    Nelson Marques

    If you are using Netbeans, then this link might help:
    http://forum.java.sun.com/thread.jspa?forumID=136&threadID=598423
    Otherwise, have you try this ?
    Verify your sun-ejb-jar.xml does not use default-resource-princinpal element:
    <res-ref-name>jdbc/pdisasdb</res-ref-name>
    <jndi-name>jdbc/pdisasdb</jndi-name>
    <default-resource-principal>
    <name>myname</name>
    <password>geheim</password>
    </default-resource-principal>
    </resource-ref>

  • Java.sql.SQLException: Error in allocating a connection

    hi,
    I have developed enterprise application using net beans IDE 5.5.I created one enity bean using sql server database.When i tried deploy this project i am getting following error...
    Internal Exception: java.sql.SQLException: Error in allocating a connection.
    Cause: Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSourceError
    can anybody please help me.....where i went wrong...i am new to netbeans IDE
    regrds
    patel

    u need to download the three jar files.
    download the following jar files and add in ur classpath.
    msutil-2000.sp2-lib.jar
    msbase-2000.sp2-lib.jar
    mssqlserver-2000.sp2-lib.jar
    This is sample program...
    u can test in standalone first and do in netbeans....
    import java.sql.*;
    public class querybean {
    public String getdata(String sql) {
         try {
    System.out.println("testing connection ");
              Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
         Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=master;user=sa;password=userpass;");
         Statement statement = connection.createStatement();
    ResultSet rs = statement.executeQuery(sql);
    System.out.println("testing connection pooling");
    while(rs.next()) {
    System.out.println(rs.getString(1));
    } catch(Exception e1) {
    System.out.println("exception caught" + e1);
    return "";
    public static void main (String args[]) throws Exception {
    querybean qb = new querybean();
    qb.getdata("select * from sampletable");
    I belive it will work now

  • Java.sql.SQLException: Cannot convert value

    I have a database table - name is client. It has one field with TimeStamp Datatype.
    I am using mysql-3.23.51-win and j2sdk-1_4_0_01-windows-i586.
    create table client (
    MODIFIED timestamp(14)
    while I am doing select MODIFIED from client that time I am receiving 00000000000000.
    So It has 00000000000000 value in databse.
    Now I am getting this value using ResultSet. for that
    I have a one Client Object class name is GenericClient
    public class GenericClient {
    private java.util.Date _modified;
    public java.util.Date getModified() {
    return _modified;
    public void setModified(java.util.Date newVal) {
    this._modified = newVal;
    In my database processing class I am getting database value and set that value in setModified(java.util.Date newVal).
    like
    private Client decodeRow(ResultSet rs) throws SQLException {
    GenericClient obj = new GenericClient();
    obj.setModified(rs.getTimestamp(1));
    return obj;
    So at obj.setModified(rs.getTimestamp(1)); line I am received error message
    java.sql.SQLException: Cannot convert value '00000000000000' from column 1 to TIMESTAMP.
    Please guide me why I am receiving the above error.
    Thanks
    Amit

    Please find some more information from my side
    1) I am passing Timestamp Object
    2) I am using PreparedStatement
    3) code
    Table : client
    create table client (
         MODIFIED timestamp(14)
    );Bean Class
    public class GenericClient {
         private java.util.Date _modified;
         public java.util.Date getModified() {
              return _modified;
         public void setModified(java.util.Date newVal) {
              this._modified = newVal;
    }Method - which is fired error
    private Client decodeRow(ResultSet rs) throws SQLException {
         GenericClient obj = new GenericClient();
         obj.setModified(rs.getTimestamp(1));
         return obj;
    }3) Error Stack
    ==========
    java.sql.SQLException: Cannot convert value '00000000000000' from column 1 to TIMESTAMP.
            at com.mysql.jdbc.ResultSet.getTimestampFromString(ResultSet.java:5538)
            at com.mysql.jdbc.ResultSet.getTimestampInternal(ResultSet.java:5566)
            at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:5219)
            at com.ksea.manager.ClientManager.decodeRow(ClientManager.java:463)
            at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:266)
            at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:221)
            at com.ksea.manager.ClientManager.loadByWhere(ClientManager.java:203)
            at com.ksea.manager.ClientManager.loadByUsername(ClientManager.java:53)
            at com.ksea.nt.DBSynch.synchEmployees(DBSynch.java:83)
            at com.ksea.nt.DBSynch.synchAll(DBSynch.java:35)
            at com.ksea.nt.DBSynch.main(DBSynch.java:168)4) db Info
    =======
    I am using mysql-3.23.51-win and j2sdk-1_4_0_01-windows-i586.

  • [b]java.sql.SQLException: Io exception: Software caused connection abort: r

    hi ,
    In my application iam getting DBconnection obj from context attribute which iam using in all my sevlets & jsp's.
    The application is running fine but sometimes iam getting following exception
    java.sql.SQLException: Io exception: Software caused connection abort: recv failed
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
    at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:417)
    at oracle.jdbc.driver.OracleConnection.privateCreateStatement(OracleConn
    ection.java:474)
    at oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.
    java:383)
    at org.apache.jsp.Vis_002dReg.GetCompNames_jsp._jspService(GetCompNames_
    jsp.java:64)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    01)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
    atcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
    ispatcher.java:575)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
    patcher.java:498)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
    .java:1002)
    at org.apache.jsp.Vis_002dReg.VisRegCustmer3_jsp._jspService(VisRegCustm
    er3_jsp.java:320)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    01)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
    3)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:619)
    at java.lang.Thread.run(Thread.java:534)
    222222 In GET COMPANY NAMES EXCEPTION
    java.lang.NullPointerException
    at org.apache.jsp.Vis_002dReg.GetCompNames_jsp._jspService(GetCompNames_
    jsp.java:101)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    01)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
    atcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
    ispatcher.java:575)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
    patcher.java:498)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary
    .java:1002)
    at org.apache.jsp.Vis_002dReg.VisRegCustmer3_jsp._jspService(VisRegCustm
    er3_jsp.java:320)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
    .java:311)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
    01)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
    t.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
    3)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:619)
    at java.lang.Thread.run(Thread.java:534)
    can any body help me with this wat went wrong, need urgent

    Something bad happened.
    Why is this such a calamity?
    Anyway something (probably the server) closed the connection probably. Maybe a time out. Or you asked for something so dispicable the database got upset and booted you out.

  • Java.sql.SQLException:Cannot open any more tables.

    I have such exception(java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Cannot open any more tables.) when I try to make request to database:
    if(null!=con)
    try{
    Statement stmt;
    stmt = con.createStatement ( ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs= stmt.executeQuery(quary);
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    ex.printStackTrace();
    }//try
    But exception occurs after several requests(about 20). First 20 requests work fine. What is it? Thanks.

    Statement stmt;
    stmt = con.createStatement ( ResultSet.TYPE_SCROLL_INSENSITIVE,
    try{
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs= stmt.executeQuery(quary);
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    ex.printStackTrace();
    }//tryyou should reuse the statement rather than opening it for every query
    Good Luck

  • Java.sql.SQLException: The TCP/IP connection to the host  has failed.

    Hello. I hope you had a happy new year! Now its back to work.
    I am having a problem connecting to a remote SQL Server DB. I am using NetBeans 5.5 and the latest J2EE. I am able to see the tables in the IDE and bind objects to data. But when I run it it gets this:
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: no further information
    at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:100)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:344)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:126)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:968)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1428)
    I checked the SQL Server Configuration manager on that machine and TCP/IP connections are allowed. What else could be wrong?
    Thank You.

    "Connection refused" means that the client sends a packet saying "I would like to connect to port number NNNN please" to the server computer, and the server computer's OS sends the reply "there is no process listening to that port on the network interface you are using".
    The database server is not running, or running but not listening to TCP/IP connections, or at a different port from what you think, or listening to only selected network interfaces (it is possible for a process to listen to a specific interface or a wildcard for all interfaces). A less likely scenario is that a firewall is sending the "connection refused" message.
    First aid check list for "connection refused":
    - Check host name in connect string.
    - Check port number in connect string.
    - Try numeric IP address of server host in connect string, in case name server is hosed.
    - Are there any firewalls between client and server blocking the port.
    - Check that the db server is running.
    - Check that the db server is listening to the port. On the server, try: "telnet localhost the-port-number". Or "netstat -an", there should be a listening entry for the port. You need to configure the database to accept TCP connections; the server documentation or google should explain how.
    - Try "telnet server-host-name the-port-number" from the client, to see if firewalls are blocking it.
    - If "telnet" fails: try telnet with the numeric ip address.
    - If "telnet" fails: does it fail immediately or after an obvious timeout? How long is the timeout?
    - Does the server respond to "ping serverhost" or "telnet serverhost" or "ssh serverhost"?

  • Java.sql.SQLException: Error accessing jdbc driver

    Hi,
    We are using WebLogic Server 7.0 as Application Server.
    We now create a connection pool named regPool and
    a Tx datasource named regDS.
    When we get the connection from the datasource, exception occurred.
    java.sql.SQLException: Error accessing jdbc driver: driverURL =
    jdbc:weblogic:pool:regPool, props = {enableTwoPhaseCommit=false,
    jdbcTxDataSource=true, connectionPoolID=regPool}
    at
    weblogic.jdbc.jts.Driver.wrapAndThrowSQLException(Driver.java:323)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:377)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:129)
    at
    weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java
    :265)
    So I guess that why we can't use CMP for finding data. Here is the error when we call the finder.
    javax.ejb.FinderException: Exception in findAllEmr while preparing or
    executing statement: 'null'
    java.sql.SQLException: Cannot obtain connection after 30 seconds. ,
    Exception = Access not allowed
    java.sql.SQLException: Cannot obtain connection after 30 seconds. ,
    Exception = Access not allowed
    at
    weblogic.jdbc.jts.Connection.wrapAndThrowSQLException(Connection.java:694)
    According to the exception message, it looks
    like the connection fail between WLS and Oracle 9.2.
    Here is a scenario I think you should need to know.
    I change the table-name in the weblogic-cmp-rdbms-jar.xml
    to a name that doesn't exist in the database.
    Then, re-package the EJB, copy it to server and restart the server.
    A exception occurred that says the table doesn't exist.
    So, in this case, it looks like the datasource works and
    connection is fine.
    Any recommendation will be appreciated.
    Jimmy Chang

    Hi!
    I am a default user to the databse server. I connect to the database with '\' as the username and blank passoword(I mean with Network authentication may be).When I am trying to create connection using
    con = DriverManager.getConnection("jdbc:oracle:thin:@DRACINAL2:BSAJ", "/","" )
    it gives me followint error
    ava.sql.SQLException: Null user or password not supported in THIN driver
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
         void oracle.jdbc.dbaccess.DBError.throwSqlException(int, java.lang.Object)
         void oracle.jdbc.dbaccess.DBError.check_error(int)
         oracle.jdbc.dbaccess.DBConversion oracle.jdbc.ttc7.TTC7Protocol.logon(java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
         void oracle.jdbc.driver.OracleConnection.<init>(oracle.jdbc.dbaccess.DBAccess, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
         java.sql.Connection oracle.jdbc.driver.OracleDriver.getConnectionInstance(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
         java.sql.Connection oracle.jdbc.driver.OracleDriver.connect(java.lang.String, java.util.Properties)
         java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties, java.lang.ClassLoader)
         java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String)
         void textPack.GenTextFile.main(java.lang.String[])
    How should I go about it?
    Thanks for your help.
    -Sreekanth Varidhireddy

  • Regarding Internal Exception: java.sql.SQLException

    While deploying the application we are encounter a following error,
    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: FATAL: sorry, too many clients already
    Error Code: 0
    Deployment error:
    Please give me a suggession for this error.
    Thanks,

    While deploying the application we are encounter a following error,
    Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: FATAL: sorry, too many clients already
    Error Code: 0
    Deployment error:
    Please give me a suggession for this error.
    Thanks,

Maybe you are looking for