X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DD873D1B7C1 for ; Wed, 23 Jun 2004 11:12:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46974-01 for ; Wed, 23 Jun 2004 14:12:23 +0000 (GMT) Received: from neouvielle.enseirb.fr (neouvielle.enseirb.fr [147.210.18.138]) by svr1.postgresql.org (Postfix) with ESMTP id D83BAD1B27A for ; Wed, 23 Jun 2004 11:12:18 -0300 (ADT) Received: from tanit.enseirb.fr (daemon@tanit [147.210.18.1]) by neouvielle.enseirb.fr (8.12.10/8.12.10) with ESMTP id i5NECLDv008915 for ; Wed, 23 Jun 2004 16:12:21 +0200 (MET DST) Received: (from alberdi@localhost) by tanit.enseirb.fr (8.12.10/8.12.10) id i5NECLKj009046 for pgsql-jdbc@postgresql.org; Wed, 23 Jun 2004 16:12:21 +0200 (MET DST) Date: Wed, 23 Jun 2004 16:12:21 +0200 From: ALBERDI Ion To: pgsql-jdbc@postgresql.org Subject: ConnectionPooling executeUpdate Message-ID: <20040623161221.A8925@enseirb.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/152 X-Sequence-Number: 10354 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(); pgSource.setServerName("localhost"); pgSource.setDatabaseName(dbName); pgSource.setUser(userName); pgSource.setPassword(password); pgSource.setMaxConnections(numberOfMaxConnections); 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(ServiceTable); query.append(" SET "); query.append(ServiceDescDocId); query.append(" = ?, "); query.append(ServiceHelpDocId); query.append(" = ? WHERE "); query.append(ServiceId); 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 :)