[jboss-user] [JCA] New message: "How to define a read-only connection ?"

Roberto Mazzola do-not-reply at jboss.com
Sun Mar 14 10:32:24 EDT 2010


User development,

A new message was posted in the thread "How to define a read-only connection ?":

http://community.jboss.org/message/531877#531877

Author  : Roberto Mazzola
Profile : http://community.jboss.org/people/rmazzola

Message:
--------------------------------------------------------------
Hi
I'm trying to define a readonly connection to a IBM DB2 (9.7) database
I try several way but without success.
 
I read also http://community.jboss.org/message/22945#22945
 
this is my definition

{code}
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
 <local-tx-datasource>
  <jndi-name>nowreadonly</jndi-name>
  <connection-url>jdbc:db2:nownwgui</connection-url>
  <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
  <user-name>db2admin</user-name>
  <password>db2admin</password>
  <connection-property name="readOnly">true</connection-property>
  <min-pool-size>1</min-pool-size>
  <max-pool-size>20</max-pool-size>
  <idle-timeout-minutes>15</idle-timeout-minutes>
  <transaction-isolation>TRANSACTION_READ_UNCOMMITTED</transaction-isolation>
 </local-tx-datasource>
</datasources>
{code}
 
I try also try using  new-connection-sql to "SET TRANSACTION READ ONLY" but it is not allowed on db2 9.7
 
To test it I have a simple JSP doing ..
 
{code}
...
public Connection getConnection(String aName)
{
 try
 {
     InitialContext vContext = new InitialContext();
  DataSource ds = (DataSource)vContext.lookup(aName);
  Connection vConnection = ds.getConnection();
  return vConnection;
 }
 catch (Exception ex)
 {
  ex.printStackTrace();
 }
 return null;
}
.....
Connection vConnection = getConnection("java:/nowreadonly");
System.out.println(" *** vConnection : " +vConnection );
System.out.println("*** vConnection.isReadOnly() : " + vConnection.isReadOnly());
...
{code}
 
But the isReadOnly return always false...

Any idea?
 
Thanks You!

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/531877#531877




More information about the jboss-user mailing list