geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Rübsam ...@coderesearch.com>
Subject Re: Problem with Geronimo 1.0, PreparedStatements, pools and MaxDB
Date Tue, 30 May 2006 15:32:49 GMT
Aaron,

connections are correctly closed. If they are returned to the pool,
don't know?

The code that opens/closes connections is a bit widespread and wrapped
into a db abstraction layer. Here are some code fragments collected
together without the try catches.


open connection:

InitialContext tCtx = new InitialContext();

mJDBCDataSource = (DataSource)tCtx.lookup(
   pDataSource.getString(PDbDataSource.URL));

String tUser = pDataSource.getString(PDbDataSource.USER, null);
String tPass = pDataSource.getString(PDbDataSource.PASS, null);

if (tUser != null) {
     mConnection = mJDBCDataSource.getConnection(tUser, tPass);
} else {
     mConnection = mJDBCDataSource.getConnection();
}

mConnection.setAutoCommit(false);



call statements:

String tStmtSQL = "SELECT ....";
PreparedStatement tStmt = mConnection.prepareStatement(tStmtSQL);

tStmt.setString(1, tName);
ResultSet tRS = tStmt.executeQuery();

while (tRS.next()) {
...
}

tRS.close();
tStmt.close();



close the connection:

mConnection.close();



The DataSource lookup happens only once. After that I only
call getConnection() on the DS and close() on the connection.

Thanks,
Mario



Aaron Mulder wrote:
> It sounds like connections are not being returned to the pool, though
> it's hard to know without a stack trace.  Also, can you post the code
> you're using to access the connection pool, execute the prepared
> statements, and close the connection?  And what kind of component is
> running these prepared statements?
> 
> Thanks,
>    Aaron
> 
> On 5/30/06, Mario Rübsam <mr@coderesearch.com> wrote:
>> Hi,
>>
>> I have some serious problems when executing prepared statements
>> on MaxDB with pooled connections managed by Tranql in Geronimo 1.0.
>>
>> The problem is, that after calling a lot of these prepared statements
>> the connection will hang until I get a timout. It's always
>> a different statement that worked just fine some milliseconds before.
>> There is no CPU load on the Geronimo machine and also no load
>> on the DB machine. Just a hang up until timeout.
>> I can run the same app on MySQL 4.x or PostgrSQL 8.x without any
>> Problems. Also no problems with a client app and MaxDB that do
>> a batch import and use exactly the same statements but without db
>> pooling.
>>
>> So I think it must be a db pool problem with the MaxDB or a
>> strange behaviour with that driver and connection pools.
>>
>> Any suggestions where I can start analysing the problem?
>>
>> here my MaxDB plan:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <connector configId="user/database-pool-jdbc/default/1/car"
>> xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.0">
>>      <dep:dependency 
>> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.0">
>>          <dep:uri>mysql/sapdbc/7.6/jar</dep:uri>
>>      </dep:dependency>
>>      <resourceadapter>
>>          <outbound-resourceadapter>
>>              <connection-definition>
>>
>> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>

>>
>>                  <connectiondefinition-instance>
>>                      <name>jdbc/default</name>
>>                      <config-property-setting
>> name="UserName">sse</config-property-setting>
>>                      <config-property-setting
>> name="Password">sse</config-property-setting>
>>                      <config-property-setting
>> name="CommitBeforeAutocommit">false</config-property-setting>
>>                      <config-property-setting
>> name="Driver">com.sap.dbtech.jdbc.DriverSapDB</config-property-setting>
>>                      <config-property-setting
>> name="ExceptionSorterClass">org.tranql.connector.AllExceptionsAreFatalSorter</config-property-setting>

>>
>>                      <config-property-setting
>> name="ConnectionURL">jdbc:sapdb://192.168.8.3/service</config-property-setting>

>>
>>                      <connectionmanager>
>>                          <local-transaction/>
>>                          <single-pool>
>>                              <max-size>100</max-size>
>>                              <min-size>50</min-size>
>>
>> <blocking-timeout-milliseconds>60000</blocking-timeout-milliseconds>
>>                              
>> <idle-timeout-minutes>60</idle-timeout-minutes>
>>                              <match-one/>
>>                          </single-pool>
>>                      </connectionmanager>
>>                  </connectiondefinition-instance>
>>              </connection-definition>
>>          </outbound-resourceadapter>
>>      </resourceadapter>
>> </connector>
>>
>>
>> Thanks,
>> Mario
>>
> 

-- 
Dipl. Inf. Mario Rübsam
Geschäftsführer
CODERESEARCH GmbH & Co. KG
mail: mr@coderesearch.com
web : www.coderesearch.com
tel : 03677/466420
fax : 03677/466419

Mime
View raw message