Unix Technical Forum

JDBC-Problem

This is a discussion on JDBC-Problem within the Informix forums, part of the Database Server Software category; --> IDS 9.40 UC3 / JDBC 2.21 Hi all, we have a very strange JDBC-Problem. We have a simple SELECT-Statment, ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 07:17 AM
Markus Bschorer
 
Posts: n/a
Default JDBC-Problem

IDS 9.40 UC3 / JDBC 2.21

Hi all,

we have a very strange JDBC-Problem.
We have a simple SELECT-Statment, something like

SELECT first_name from adr where name = 'Huber';

Executing this statement via JDBC by using this code:
....
Statement stmt = connection.createStatement();
stmt.executeQuery("SELECT first_name from adr where name = 'Huber'");
....
we get a result after a few milliseconds. In a loop of size 100, it takes
1.2 seconds.

BUT:
=====

Executing this statement via JDBC by using this code:
....
PreparedStatement stmt = connection.prepareStatement(SELECT first_name
from adr where name = ?");
stmt.setString(1, "Huber");
stmt.executeQuery();
....
we get a result after alittle more than 1 seconds. In a loop of size 100,
it takes 100 seconds.


It seems, that Informix has a problem using parameterized
prepared-statements.

Any ideas?

Thanks in advance!

bye
Markus





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 07:18 AM
Amit Dandekar
 
Posts: n/a
Default Re: JDBC-Problem

When running in a loop ,
ensure that you are not re-preparing the select statement each time before
executing it.
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 09:39 AM.


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