pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedusing postgresql-8.0-311.jdbc2.jar
5+ messages / 3 participants
[nested] [flat]
* using postgresql-8.0-311.jdbc2.jar
@ 2005-06-29 07:39 sarves <sharvesh@midascomm.com>
2005-06-29 08:05 ` Re: using postgresql-8.0-311.jdbc2.jar Roland Walter <rwa@mosaic-ag.com>
2005-06-29 14:35 ` Re: using postgresql-8.0-311.jdbc2.jar Roland Walter <rwa@mosaic-ag.com>
0 siblings, 2 replies; 5+ messages in thread
From: sarves @ 2005-06-29 07:39 UTC (permalink / raw)
To: pgsql-jdbc
Dear sir,
I was interfacing with postgreSQL 7.1.3 from my application
using the JDBC driver released with it. Now,I'm trying to communicate
with postgreSQL 8.0.3 with postgresql-8.0-311.jdbc2.jar. PostgreSQL
8.0.3 server is running on another machine in LAN. My application
connects to the server using postgresql-8.0-311.jdbc2.jar. While it is
possible to connect to the server,the response for each query is empty
data though there's data in server for the given query. The following
method is used to execute each query:
public Vector TableQuery(String instruction) {
SQL = instruction;
Vector queryResult= new Vector(); //Vector de vectores
Vector TableRow = new Vector();
TableHeader = new Vector();
ResultSet rs;
try {
rs = st.executeQuery(instruction);
ResultSetMetaData rsmd = rs.getMetaData();
// Extraer Nombres de Columnas
int cols = rsmd.getColumnCount();
for(int i=1;i<=cols;i++)
TableHeader.addElement(rsmd.getColumnLabel(i));
// Extraer registros
int num = rs.getFetchSize();
if (num>0) {
while (rs.next()) {
TableRow = new Vector();
for (int i=1;i<=cols;i++) {
Object o = rs.getObject(i);
if (rs.wasNull())TableRow.addElement(o);
}
queryResult.addElement(TableRow);
}
wasFail = false;
}
}
catch(Exception ex) {
wasFail = true;
problem = ex.getMessage();
System.out.println("Error: " + ex);
ex.printStackTrace();
}
return queryResult;
}
No exception is thrown. It should be noted that the same snippet works
if I use the JDBC driver given with postgreSQL 7.1.3 to communicate with
postgreSQL 8.0.3.
What could the problem be?
Thanks in advance.
sincerely,
Sarveswaran M
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using postgresql-8.0-311.jdbc2.jar
2005-06-29 07:39 using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
@ 2005-06-29 08:05 ` Roland Walter <rwa@mosaic-ag.com>
1 sibling, 0 replies; 5+ messages in thread
From: Roland Walter @ 2005-06-29 08:05 UTC (permalink / raw)
To: sarves <sharvesh@midascomm.com>; +Cc: pgsql-jdbc
sarves schrieb:
> Dear sir,
>
> I was interfacing with postgreSQL 7.1.3 from my application
> using the JDBC driver released with it. Now,I'm trying to communicate
> with postgreSQL 8.0.3 with postgresql-8.0-311.jdbc2.jar. PostgreSQL
> 8.0.3 server is running on another machine in LAN. My application
> connects to the server using postgresql-8.0-311.jdbc2.jar. While it is
> possible to connect to the server,the response for each query is empty
> data though there's data in server for the given query. The following
> method is used to execute each query:
>
> public Vector TableQuery(String instruction) {
>
> SQL = instruction;
> Vector queryResult= new Vector(); //Vector de vectores
> Vector TableRow = new Vector();
> TableHeader = new Vector();
> ResultSet rs;
>
> try {
> rs = st.executeQuery(instruction);
> ResultSetMetaData rsmd = rs.getMetaData();
> // Extraer Nombres de Columnas
> int cols = rsmd.getColumnCount();
> for(int i=1;i<=cols;i++)
> TableHeader.addElement(rsmd.getColumnLabel(i));
> // Extraer registros
> int num = rs.getFetchSize();
>
> if (num>0) {
>
> while (rs.next()) {
>
> TableRow = new Vector();
>
> for (int i=1;i<=cols;i++) {
>
> Object o = rs.getObject(i);
>
> if (rs.wasNull())TableRow.addElement(o);
Shouldn't this line be if (!rs.wasNull()) TableRow.addElement(o)?
> }
>
> queryResult.addElement(TableRow);
> }
> wasFail = false;
> }
> }
> catch(Exception ex) {
> wasFail = true;
> problem = ex.getMessage();
> System.out.println("Error: " + ex);
> ex.printStackTrace();
> }
>
> return queryResult;
> }
>
--
Roland Walter
MOSAIC SOFTWARE AG
Telefon: 02225/882-411 Fax: 02225/882-201
http://www.mosaic-ag.com
------- L E G A L D I S C L A I M E R ---------
Die Informationen in dieser Nachricht sind vertraulich
und ausschliesslich fuer den Adressaten bestimmt.
Kenntnisnahme durch Dritte ist unzulaessig. Die
Erstellung von Kopien oder das Weiterleiten an weitere,
nicht originaere und benannte Adressaten ist nicht
vorgesehen und kann ungesetzlich sein. Die Meinungen
in dieser Nachricht stellen lediglich die Meinungen
des Senders dar. Falls Sie vermuten, dass diese
Nachricht veraendert wurde, setzen Sie sich mit dem
Absender in Verbindung. Der Absender uebernimmt ohne
weitere Ueberpruefung keine Verantwortung fuer die
Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte
Empfaenger werden gebeten, die Vertraulichkeit der
Nachricht zu wahren und den Absender sofort ueber
einen Uebertragungsfehler zu informieren.
------------------------------------------------------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using postgresql-8.0-311.jdbc2.jar
2005-06-29 07:39 using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
@ 2005-06-29 14:35 ` Roland Walter <rwa@mosaic-ag.com>
2005-06-29 14:54 ` Re: using postgresql-8.0-311.jdbc2.jar Oliver Jowett <oliver@opencloud.com>
1 sibling, 1 reply; 5+ messages in thread
From: Roland Walter @ 2005-06-29 14:35 UTC (permalink / raw)
To: sarves <sharvesh@midascomm.com>; +Cc: pgsql-jdbc
sarves schrieb:
> Dear sir,
>
> I was interfacing with postgreSQL 7.1.3 from my application
> using the JDBC driver released with it. Now,I'm trying to communicate
> with postgreSQL 8.0.3 with postgresql-8.0-311.jdbc2.jar. PostgreSQL
> 8.0.3 server is running on another machine in LAN. My application
> connects to the server using postgresql-8.0-311.jdbc2.jar. While it is
> possible to connect to the server,the response for each query is empty
> data though there's data in server for the given query. The following
> method is used to execute each query:
>
> public Vector TableQuery(String instruction) {
>
> SQL = instruction;
> Vector queryResult= new Vector(); //Vector de vectores
> Vector TableRow = new Vector();
> TableHeader = new Vector();
> ResultSet rs;
>
> try {
> rs = st.executeQuery(instruction);
> ResultSetMetaData rsmd = rs.getMetaData();
> // Extraer Nombres de Columnas
> int cols = rsmd.getColumnCount();
> for(int i=1;i<=cols;i++)
> TableHeader.addElement(rsmd.getColumnLabel(i));
> // Extraer registros
> int num = rs.getFetchSize();
As far as I know, getFetchSize() will return 0 in all cases.
It is not possible to use this for getting the count of
selected rows. Remove the if (num>0) below.
>
> if (num>0) {
>
> while (rs.next()) {
>
> TableRow = new Vector();
>
> for (int i=1;i<=cols;i++) {
>
> Object o = rs.getObject(i);
>
> if (rs.wasNull())TableRow.addElement(o);
> }
>
> queryResult.addElement(TableRow);
> }
> wasFail = false;
> }
> }
> catch(Exception ex) {
> wasFail = true;
> problem = ex.getMessage();
> System.out.println("Error: " + ex);
> ex.printStackTrace();
> }
>
> return queryResult;
> }
>
> No exception is thrown. It should be noted that the same snippet works
> if I use the JDBC driver given with postgreSQL 7.1.3 to communicate with
> postgreSQL 8.0.3.
>
> What could the problem be?
> Thanks in advance.
>
> sincerely,
> Sarveswaran M
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
--
Roland Walter
MOSAIC SOFTWARE AG
Telefon: 02225/882-411 Fax: 02225/882-201
http://www.mosaic-ag.com
------- L E G A L D I S C L A I M E R ---------
Die Informationen in dieser Nachricht sind vertraulich
und ausschliesslich fuer den Adressaten bestimmt.
Kenntnisnahme durch Dritte ist unzulaessig. Die
Erstellung von Kopien oder das Weiterleiten an weitere,
nicht originaere und benannte Adressaten ist nicht
vorgesehen und kann ungesetzlich sein. Die Meinungen
in dieser Nachricht stellen lediglich die Meinungen
des Senders dar. Falls Sie vermuten, dass diese
Nachricht veraendert wurde, setzen Sie sich mit dem
Absender in Verbindung. Der Absender uebernimmt ohne
weitere Ueberpruefung keine Verantwortung fuer die
Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte
Empfaenger werden gebeten, die Vertraulichkeit der
Nachricht zu wahren und den Absender sofort ueber
einen Uebertragungsfehler zu informieren.
------------------------------------------------------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using postgresql-8.0-311.jdbc2.jar
2005-06-29 07:39 using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
2005-06-29 14:35 ` Re: using postgresql-8.0-311.jdbc2.jar Roland Walter <rwa@mosaic-ag.com>
@ 2005-06-29 14:54 ` Oliver Jowett <oliver@opencloud.com>
2005-06-30 04:46 ` Re: using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Jowett @ 2005-06-29 14:54 UTC (permalink / raw)
To: Roland Walter <rwa@mosaic-ag.com>; +Cc: sarves <sharvesh@midascomm.com>; pgsql-jdbc
Roland Walter wrote:
> As far as I know, getFetchSize() will return 0 in all cases.
> It is not possible to use this for getting the count of
> selected rows. Remove the if (num>0) below.
Yes, this'll be the cause: older driver versions incorrectly returned
the resultset size from getFetchSize(), but newer drivers follow the
spec and return whatever you set via setFetchSize(), default 0.
-O
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: using postgresql-8.0-311.jdbc2.jar
2005-06-29 07:39 using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
2005-06-29 14:35 ` Re: using postgresql-8.0-311.jdbc2.jar Roland Walter <rwa@mosaic-ag.com>
2005-06-29 14:54 ` Re: using postgresql-8.0-311.jdbc2.jar Oliver Jowett <oliver@opencloud.com>
@ 2005-06-30 04:46 ` sarves <sharvesh@midascomm.com>
0 siblings, 0 replies; 5+ messages in thread
From: sarves @ 2005-06-30 04:46 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; Roland Walter <rwa@mosaic-ag.com>; +Cc: pgsql-jdbc
Dear Oliver & Roland,
You guys are rite. I got rid fo the dependency on
getFetchSize() and my program works fine now. Thanks for the timely help.
sarvesh
Oliver Jowett wrote:
>Roland Walter wrote:
>
>
>
>>As far as I know, getFetchSize() will return 0 in all cases.
>>It is not possible to use this for getting the count of
>>selected rows. Remove the if (num>0) below.
>>
>>
>
>Yes, this'll be the cause: older driver versions incorrectly returned
>the resultset size from getFetchSize(), but newer drivers follow the
>spec and return whatever you set via setFetchSize(), default 0.
>
>-O
>
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-06-30 04:46 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-29 07:39 using postgresql-8.0-311.jdbc2.jar sarves <sharvesh@midascomm.com>
2005-06-29 08:05 ` Roland Walter <rwa@mosaic-ag.com>
2005-06-29 14:35 ` Roland Walter <rwa@mosaic-ag.com>
2005-06-29 14:54 ` Oliver Jowett <oliver@opencloud.com>
2005-06-30 04:46 ` sarves <sharvesh@midascomm.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox