Re: slow jdbc postgres connection - Mailing list pgsql-jdbc

From Stefan Zweig
Subject Re: slow jdbc postgres connection
Date
Msg-id 58987573@web.de
Whole thread Raw
In response to slow jdbc postgres connection  (Stefan Zweig <stefanzweig1881@web.de>)
Responses Re: slow jdbc postgres connection  (Craig Servin <cservin@cromagnon.com>)
List pgsql-jdbc
hi,

just to be sure that it cannot be the intranet-connection i tried to run my java test database application directly on
theserver. mysql-jdbc answered within 20ms pgsql-jdbc needed 5494ms and i have no idea why? 

any advices would be appreciated.

regards. stefan
> hi i have the following problem:
>
> when i execute the following query via pgAdminIII i get a result within 31ms
>
> Select version()
> result: PostgreSQL 8.1
>
> if try to execute the same query using the jdbc-interface from a java-application the same query needs horrible
4756ms.
> my jdbc driver is  8.1-409 JDBC 3
> my postgres version is 8.1.8
> my JRE-Version: 1.5.0_07
>
> Connection pgconnection = null;
>
> // Load the pgSQL JDBC driver
> String pgdriverName = "org.postgresql.Driver";
> Class.forName(pgdriverName);
>
> // Create a connection to the "test" database
> String pgserverName = "10.100.6.245";
> String pgdatabase = "test";
> String url = "jdbc:postgresql://" + pgserverName +  "/" + pgdatabase + "?characterEncoding=UTF8&useUnicode=true";
> String username = "user";
> String password = "password";
>
> pgconnection = DriverManager.getConnection(url, username, password);
>
> ResultSet pgresultSet;
> Statement pgstatement;
> pgstatement = pgconnection.createStatement();
>
> String pgquery;
> pgquery="SELECT version()";
>
>
> long start=System.currentTimeMillis();//start time measurement
>
> pgresultSet = pgstatement.executeQuery(pgquery);
>
> long time=System.currentTimeMillis()-start;//end time measurement
>
> //time =4756ms
>
> pgconnection.close();
>
>
> if i do the similar query on our mysql database, which is on the same local server, i get quick results, so the
reasonprobably cannot be a slow intranet-connection 
>
>
> any help would be appriciated.
>
>
> regards. stefan
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>


_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


pgsql-jdbc by date:

Previous
From: Stefan Zweig
Date:
Subject: slow jdbc postgres connection
Next
From: Heikki Linnakangas
Date:
Subject: Re: slow jdbc postgres connection