Unix Technical Forum

BUG #2636: JDBC error behaviour incorrect

This is a discussion on BUG #2636: JDBC error behaviour incorrect within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 2636 Logged by: Kiren Pillay Email address: kiren.pillay@standardbank.co.za PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 11:14 AM
Kiren Pillay
 
Posts: n/a
Default BUG #2636: JDBC error behaviour incorrect


The following bug has been logged online:

Bug reference: 2636
Logged by: Kiren Pillay
Email address: kiren.pillay@standardbank.co.za
PostgreSQL version: 8.1.4
Operating system: Windows
Description: JDBC error behaviour incorrect
Details:

Hi

Here is my code snippet:
<--

public Hashtable retrieveApplicationParameters() {
PreparedStatement ps = null;
ResultSet rs = null;

String loadApplicationParameters = " SELECT key_id, key_value FROM
application_parameters WHERE is_active = 1";

Hashtable values = new Hashtable();
try {
DBActions db=DBActions.getInstance();


rs = db.getConnection().prepareCall(loadApplicationPara meters
).executeQuery();
while (rs.next()) {
// Testing
values.put(rs.getString(1), rs.getString(2));
System.out.println(rs.getString(1)+","+ rs.getString(2));
}
} catch (SQLException sqle) {
logger.error("Could not load application parameters ", sqle);
}
catch (Exception e){
e.printStackTrace();
}
catch (Throwable e){
e.printStackTrace();
}
/*finally {

DBConnection.close(rs, ps);
}*/
return values;
}

-->

In this code, the program gets to the executeQuery part with no exception.
When it gets to the rs.next() part, the code jumps to the finally block.
This is non-deterministic behaviour as the code seems to have thrown an
exception, but even the catch Throwable part does not catch the error.

The database being connected to is a restore from another database. The fact
is this database restore could be incorrect, but how can I find the actual
error
cause of the problem. Is there a way to increase the logging so that I can
figure out the problem here.

Sorry I can't give more info than this until i can learn how to turn the
debugging for the jdbc driver and so on.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 11:15 AM
Kris Jurka
 
Posts: n/a
Default Re: BUG #2636: JDBC error behaviour incorrect



On Mon, 18 Sep 2006, Kiren Pillay wrote:

> The following bug has been logged online:
>
> Bug reference: 2636
> PostgreSQL version: 8.1.4
> Operating system: Windows
> Description: JDBC error behaviour incorrect
> Details:
>
> try {
> DBActions db=DBActions.getInstance();
>
>
> rs = db.getConnection().prepareCall(loadApplicationPara meters
> ).executeQuery();
> while (rs.next()) {
> // Testing
> values.put(rs.getString(1), rs.getString(2));
> System.out.println(rs.getString(1)+","+ rs.getString(2));
> }
> } catch (SQLException sqle) {
> logger.error("Could not load application parameters ", sqle);
> }
> catch (Exception e){
> e.printStackTrace();
> }
> catch (Throwable e){
> e.printStackTrace();
> }
> /*finally {
>
> DBConnection.close(rs, ps);
> }*/
>
>
> In this code, the program gets to the executeQuery part with no exception.
> When it gets to the rs.next() part, the code jumps to the finally block.
> This is non-deterministic behaviour as the code seems to have thrown an
> exception, but even the catch Throwable part does not catch the error.


Isn't it just likely that rs.next() returned false?

> The database being connected to is a restore from another database. The fact
> is this database restore could be incorrect, but how can I find the actual
> error
> cause of the problem. Is there a way to increase the logging so that I can
> figure out the problem here.


The driver can be started given a URL connection parameter ?loglevel=2
that will print out a fair amount of protocol information.


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com