[pgpool-general: 2382] Re: Error when use pgpool2 with JDBC

Denis Thomas dthomas at telecomdesign.fr
Wed Jan 8 17:32:29 JST 2014


thanks for your help.
I finally managed to use pgpool2 with JDBC. I replaced version 3.1.1 
from Ubuntu package by 3.3.2 I compiled, and I add in connection 
parameters protocol version 2.
My program is not a web application with Tomcat or another servlet 
container, but a little test program written just to try pgpool. I use 
org.apache.commons.dbcp.BasicDataSource to connect and Spring templates 
to send query to database. Here my datasource bean :

<bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource">
     <property name="username" value="XXX" />
     <property name="password" value="XXX" />
     <property name="url" value="jdbc:postgresql://server/database" />
     <property name="driverClassName" value="org.postgresql.Driver" />
     <property name="connectionProperties" value="protocolVersion=2" />

By putting protocolVersion=2, that works, but now I 'm facing another 
problems : I have no load balancing, and for transaction, I cannot use 
read-only transaction with propagation required (I have to use 
propagation="SUPPORTS"). But may be these problems come from my program, 
and when I'll test later with a real web application they will disappear.


Le 07/01/2014 11:46, Lachezar Dobrev a écrit :
>    Denis,
>    Could you share the way your JDBC Pool is set up? Do you use
> Tomcat's pooling? It might be something specific there.
>    What's the URL you're using, does it have any parameters (omit
> security configuration).
>    Google-ing this one shows some references to some decisions in 2009…
>    As far as I can tell the query is executed by the JDBC Driver if the
> data base is version 9.0 or newer:
>     org.postgresql.core.v3.ConnectionFactoryImpl.java#runInitialQueries(...)
>    It seems the driver sets the extra_float_digits to 2 in the start-up
> packet, and then after connecting (and getting the actual version)
> tries to increase it if the database is version 9.0 or newer.

More information about the pgpool-general mailing list