TeamJava Forum

[ Read Responses | Post a New Response | Return to the Index ]
[ Previous | Next ]


improving performance with interbase

Posted by nosphe on Wednesday, 4 June 2003, at 8:22 a.m.

hi everyone

I'm having a little problem while running this pýece of code. It executes perfectly, but the first time I execute this in my application it gets about 10 seconds to show me the results. The tables are stupýdly small (less than 100 rows each), so I'm a lot confused about this delay.

I want to know if there's a way to speed up this query the first time it executes.

Thanx in advance

and here's the code:

try {
String str = new String();
Class.forName("interbase.interclient.Driver");
Connection con = DriverManager.getConnection("jdbc:interbase://localhost/C:/mypath/mydb.gdb","SYSDBA", "masterkey");
Statement sment = con.createStatement();
ResultSet rs = sment.executeQuery("SELECT * FROM table1 order by field1");
while ( rs.next() && i Statement stat = con.createStatement();
str = String.valueOf(rs.getInt("field2"));
ResultSet sr = stat.executeQuery("SELECT field3 FROM table2 where field2= "+str);

if(sr.next()){
el = dom.createElement("field1");
el.setAttribute("field3", sr.getString("field3"));
root.appendChild(el);
i++;
}
sr.close();
stat.close();
}

rs.close();
sment.close();
con.close();
} catch ( Exception se ) {System.err.println("Exception "+se);}


Responses


Post a New Response

Please select: Discussion Question Answer
Pulse Check - enter num: 1060051478

Your Name:

E-Mail Address:

Subject:

Message:


If you'd like to include a link to another page with your message,
please provide both the URL address and the title of the page:

Optional Link URL:

Optional Link Title:


If you'd like to have the option of deleting your post later,
please provide a password (CASE SENSITIVE!):

Password:



Password:

The TeamJava Forum is maintained with WebBBS 2.24.


TeamJavaHome | Ind. Registry | Co. Registry | Java Links
Jobs Listings Forum | TeamJava Books | Java FAQ Archives

AWN

Copyright © 1995-2003 Active Web Networks, all rights reserved.
(Note: We share no direct association with Sun Microsystems, Inc.)