Re: JVM & JDBC Upgrade --- Help !! - Mailing list pgsql-jdbc
From | Craig Golby |
---|---|
Subject | Re: JVM & JDBC Upgrade --- Help !! |
Date | |
Msg-id | 002e01cc797d$97f8ce40$c7ea6ac0$@golby@dignitas.ltd.uk Whole thread Raw |
In response to | Re: JVM & JDBC Upgrade --- Help !! (Craig Ringer <ringerc@ringerc.id.au>) |
List | pgsql-jdbc |
Craig, danap, thanks for the steer. I guess what is confusing me is that it works for pg73jdbc3 and fails when I switch it for postgresql-8.3-603.jdbc4
I have added a load of Sys Outs to try and figure out the location of the error, the code is pasted below.
When I run this on the pg73jdbc3 Driver, so the existing solution, I get ..
credability:Bean:reports:ataglance - starting getCurrent : columnCount = 5
credability:Bean:reports:ataglance - starting getCurrent : rowCount = 3
and of course there are multiple loops of the sysouts in the While loops.
However when I run it using the postgresql-8.3-603.jdbc4, it spools out the following and then stops working…
credability:Bean:reports:ataglance - starting getCurrent : columnCount = 5
credability:Bean:reports:ataglance - starting getCurrent : rowCount = 0
credability:Bean:reports:ataglance - starting getCurrent : b4 while
credability:Bean:reports:ataglance - starting getCurrent : in while
credability:Bean:reports:ataglance - starting getCurrent : in 2nd while
credability:Bean:reports:ataglance - starting getCurrent : r = 0
credability:Bean:reports:ataglance - starting getCurrent : c = 0
So either the query is returning no data or the getFetchSize isnt working properly.
Thoughts ??
CODE SNIPPET …
if(conn != null)
{ try
{ pStmt = conn.prepareStatement(stmtStringSel);
pStmt.clearParameters();
rsID = pStmt.executeQuery();
//Set up the Array
ResultSetMetaData rsmd = rsID.getMetaData();
int columnCount = rsmd.getColumnCount();
int rowCount = rsID.getFetchSize();
rsCurrentreturn = new String[rowCount][columnCount];
System.out.println(sysOut + "starting getCurrent : columnCount = " + columnCount);
System.out.println(sysOut + "starting getCurrent : rowCount = " + rowCount);
int r=0;
System.out.println(sysOut + "starting getCurrent : b4 while");
while(rsID.next())
{ System.out.println(sysOut + "starting getCurrent : in while");
int c=0;
int rsc=1;
while (rsc <= columnCount)
{ System.out.println(sysOut + "starting getCurrent : in 2nd while");
System.out.println(sysOut + "starting getCurrent : r = " + r);
System.out.println(sysOut + "starting getCurrent : c = " + c);
rsCurrentreturn[r][c] = rsID.getString(rsc);
c++;
rsc++;
}
System.out.println(sysOut + "starting getCurrent : r++");
r++;
}
System.out.println(sysOut + "starting getCurrent : pStmt CLose");
pStmt.close();
}catch(SQLException se) {se.printStackTrace();}
System.out.println(sysOut + "starting getCurrent : Done");
}
stmtStringSel = "";
closeConnection();
System.out.println(sysOut + "starting getCurrent : Connection closed");
}
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Craig Ringer
Sent: 22 September 2011 05:26
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JVM & JDBC Upgrade --- Help !!
On 09/22/2011 06:53 AM, Craig Golby wrote:
Code Snippet …
if(conn != null)
{ try
{ pStmt = conn.prepareStatement(stmtStringSel);
pStmt.clearParameters();
rsID = pStmt.executeQuery();
//Set up the Array
ResultSetMetaData rsmd = rsID.getMetaData();
int columnCount = rsmd.getColumnCount();
int rowCount = 7;
rsOpened = new String[rowCount][columnCount];
int r=0;
while(rsID.next())
{ int c=0;
int rsc=1;
while (rsc <= columnCount)
{ rsOpened[r][c] = rsID.getString(rsc);
Is the above line where the exception is thrown from? You didn't provide full exception context.
If so, check and make sure the column count reported by `getColumnCount' matches what you expect and what the old driver provided. Compare it to the table. Compare the column-list metadata output from the old and new drivers to see which column(s) have appeared/disappeared.
--
Craig Ringer
pgsql-jdbc by date: