Hi
I will try to give u as much info as possible
1) we are looking up the data source only once and keeping it in a static reference
2) getConnection is invoked from the helper class for the stateful session bean
3) the connection is stored in a member variable in the helper class
4) Auto commit is returning true.
5) The logic of the application is that when the first user logs in a connection is 
obtained from 
   DataSource and kept open for common functions like authenticating the user etc. 
Subsequently a       connection is taken from the datasource for the logging the 
activities of the user as well for the query operations of the user. For every fresh 
transaction the user starts a new connection is taken from the data source. When the 
user session ends the connection is closed.
We are not using any connection pool.
6)Is it possible to disable the CachedConnectionManager.
7)  the details of oracle-ds.xml is given below:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>Data</jndi-name>
    <connection-url>jdbc:oracle:thin:@xx.xxx.com:1521:orcl</connection-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <user-name>post_dev</user-name>
    <password>******</password>
  </local-tx-datasource>
</datasources>

8) Even when we comment the setAutoCommit(false) in the code we are getting the 
following error
>       

I had also set  CachedConnectionManager in transaction-service.xml( SpecCompliant to 
true ) 


10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit 
set!
> 10:45:37,859 ERROR [STDERR]     at 
> org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit
> BaseWrapperManagedConnection.java:494)
> 10:45:37,859 ERROR [STDERR]     at 
> org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465)
> 10:45:37,859 ERROR [STDERR]     at 
> com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318)


Could you pls help as we are stuck up with this.

Regards
Rajesh

-----Original Message-----
From: Adrian Brock [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 6:30 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] error while trying to open a new connection


Again you'll have to give me some information.
Where is getConnection() invoked and where do you store the connection?
What is done between getting the connection and the commit()?
Is this a StatefulSessionBean?
What is the deployment descriptor for the resource-ref?

What does the following return just before the commit():
m_dbCon.getAutoCommit();
((org.jboss.resource.adapter.jdbc.WrappedConnection)
m_dbCon).getUnderylingConnection().getAutoCommit();

You know this kind of pattern won't scale. You are not
using the pool. You will need one db connection per user.

Regards,
Adrian

On Wed, 2003-09-24 at 07:48, rajeshnn wrote:
> Hi Adrian
> Thanks you very much for the quick response.
> 
>       The issue described in the earlier mail(below) has been solved while using 
> jboss-3.2.2RC4 ( latest jboss release ), as advised by you.
> Now i am facing a new error.
> 
>       java.sql.SQLException: You cannot commit with autocommit set!
> 
>       I had also set  CachedConnectionManager in transaction-service.xml( 
> SpecCompliant to true ) ),
> 
> code is given below:
> ===============
> public Connection getConnection(){
>       String m_strDefaultDataSource   ="java:comp/env/jdbc/Data";
> 
>       InitialContext ic                       = new InitialContext();
>       DataSource m_dsCommmon  = ( DataSource ) ic.lookup( m_strDefaultDataSource );
>       m_dbCon                 = m_dsCommmon.getConnection();
>       m_dbCon.setAutoCommit(false);
>       
>       return m_dbCon;
> }
> 
> private boolean storeSignInDetails(String  strUserName,String strClientIp , 
> Connection m_dbCon){
> 
>       String strUserId        = getUserId();
>       strUserId                       = ( null == strUserId )?"Invalid":strUserId;
> 
>       String strQuery ="//sql statement for logging //
>       try{
>               Statement stmt = m_dbCon.createStatement();
>               int iCount = stmt.executeUpdate(strQuery);
>               m_dbCon.commit();
> 
>       }catch(Exception e){
>               e.printStackTrace();
>               return false;
>       }
> 
>       return true;
> 
>       }
> 
> // Also pls note that i am not closing the connection, as this is used for further 
> transaction.
> // We are using bean managed transaction . We are handling the transaction using 
> JDBC only (not using JavaTransaction API).
> //Initially after successful logging of the user, the user details are logged and it 
> is commited
>       ( Given in the  above function --storeSignInDetails () ).
> //Later it is commited , only when the user finishes his transaction.
> // So we need to use setAutoCommit( false );
> 
> Is there any way to prevent this issue....
> 
> Also can u please clarify as to what JBoss is expecting. Do we need to disable 
> CachedConnectionManager??
>       
> 
> 10:45:37,843 ERROR [STDERR] java.sql.SQLException: You cannot commit with autocommit 
> set!
> 10:45:37,859 ERROR [STDERR]     at 
> org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit
> BaseWrapperManagedConnection.java:494)
> 10:45:37,859 ERROR [STDERR]     at 
> org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:465)
> 10:45:37,859 ERROR [STDERR]     at 
> com.suntec.tbms3.ui.CUserValidateSB.storeSignInDetails(CUserValidateSB.java:318)
> 
> -----Original Message-----
> From: Adrian Brock [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 23, 2003 8:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] error while trying to open a new connection
> 
> 
> You'll have to provide some more information.
> It says you are closing a connection that it does not know about
> were there previous errors?
> 
> There has been some cleanup of the error checking in the 3.2.2RC 
> releases can you check if you still have the problem with 3.2.2RC4?
> 
> This actual error shouldn't cause any problems it is a sanity
> check in the internal datastructure tidyup code. 
> I would expect the connection has already 
> been tidied up by a previous error?
> 
> Regards,
> Adrian
> 
> On Tue, 2003-09-23 at 15:46, rajeshnn wrote:
> > Hi All
> > While trying to create a new connection before closing an existing
> > connection
> > the following error  occured. 
> > Can anyone pls help..
> > 
> > 
> > java.lang.IllegalStateException: Trying to return an unknown
> > connection2! org.jboss.resource.adapter
> > [EMAIL PROTECTED]
> >         at
> > org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedC
> > onnectionManager.java:275)
> >         at
> > org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connec
> > tionClosed(TxConnectionManager.java:550)
> >         at
> > org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManag
> > edConnection.java:280)
> >         at
> > org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:127)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:324)
> >         at
> > org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll(CachedConnectionMan
> > 
> > Rajesh N Nair
> > SunTec Business Solution,
> > # 311, Nila ,Technopark, Trivandrum,
> > Kerala, India. Pin:695581.
> > Phone ( +91-471-2700984-95)
> > 
> > 
> > 
> >  
> > 
> > 
> > ______________________________________________________________________
> > This electronic mail (including any attachment thereto) may be
> > confidential and privileged and is intended only for the individual or
> > entity named above. Any unauthorized use, printing, copying,
> > disclosure or dissemination of this communication may be subject to
> > legal restriction or sanction. Accordingly, if you are not the
> > intended recipient, please notify the sender by replying to this email
> > immediately and delete this email (and any attachment thereto) from
> > your computer system....Thank You
-- 
xxxxxxxxxxxxxxxxxxxxxxxx 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
xxxxxxxxxxxxxxxxxxxxxxxx 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



This electronic mail (including any attachment thereto) may be confidential and 
privileged and is intended only for the individual or entity named above. Any 
unauthorized use, printing, copying, disclosure or dissemination of this communication 
may be subject to legal restriction or sanction. Accordingly, if you are not the 
intended recipient, please notify the sender by replying to this email immediately and 
delete this email (and any attachment thereto) from your computer system...Thank You



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to