Skip site navigation (1) Skip section navigation (2)

ConnectionPooling executeUpdate

From: ALBERDI Ion <alberdi(at)enseirb(dot)fr>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: ConnectionPooling executeUpdate
Date: 2004-06-23 14:12:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hi everybody!
First excuse me for my poor english, I'm not a native english speaker :-).

I have problems with the ConnectionPooling Implementation of the 4.3 postgresql jdbc driver: (pg74.214.jdbc3.jar).
I'm using the 4.3-1 postgresql server under windows 2000 with cygwin.
There is my problem:
I am trying to comunicate with this datasource from a web application(the web-server is websphere 5.1 and we use jsp,servlets...).

First I cannot manage to configure the datasource so that the application takes it in account (with WSAD5.1 I configure a new datasource implemented by org.postgresql.jdbc3.Jdbc3PoolingDataSource and with the serverName dataBaseName,user,maxConnections and password properties set), I launch the server and during the execution I get an exception which says something like  Driver cast exception this driver cannot be used as one phase.

So I tried another thing, instead of configuring the datasource with the websephere interface I configure it with javacode (I know that I may not do that because the code results to be less portable). So there is my code:

Jdbc3PoolingDataSource pgSource = new Jdbc3PoolingDataSource();
		ds = (javax.sql.DataSource)pgSource;
and to obtain a connection I do:

Connection con = ds.getConnection.

I launch the server and test it. All the select queries work well, but when I try to do the first update of the database:

query = new StringBuffer();
query.append("UPDATE ");
query.append(" SET ");
query.append(" = ?, ");
query.append(" = ? WHERE ");
query.append(" = ?");		
// Execute the query:
psmt = con.prepareStatement(query.toString());
psmt.setString(1, ddId);
psmt.setString(2, hdId);	
psmt.setString(3, svcId);
numUpdates = psmt.executeUpdate();

What happens there is that with Connection Pooling the executeUpdate method always returns 0, and that the database is not upgraded.
I'm currently forced to use the Jdbc3SimpleDataSource class (with this class the application runs perfectly) but I would like to use Connection Pools to improve the application's performances.

Thanks for having read my mail until the end :)  			


pgsql-jdbc by date

Next:From: Dave CramerDate: 2004-06-23 14:39:13
Subject: Re: ConnectionPooling executeUpdate
Previous:From: ALBERDI IonDate: 2004-06-23 14:09:20
Subject: PoolingDataSource executeUpdate

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group