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
The TeamJava Forum is maintained with WebBBS 2.24.