aspose file tools*
The moose likes JDBC and the fly likes database accessing time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database accessing time" Watch "database accessing time" New topic
Author

database accessing time

amrita sankar
Greenhorn

Joined: Jan 25, 2006
Posts: 26
hi all

I am accessing the table to display its contents using JSP and JDBC
That table is having more than 400 records and it takes too much time to load.The table is having only two columns and it is a look up table.

The code is something like this
Statement stmt = conn.createStatement();
ResultSet rst=stmt.executeQuery("SELECT * FROM lookup");
while(rst.next())
{
City= rst.getString(1);
%>
<tr>
<td > <h4><%out.println(City);%></h4></td>
<%
Pop= rst.getString(2);
%>
<td > <%out.println(Pop);%></h4></td>
</tr>

Can anyone suggest a suitable method to reduce the accessing time

Sankar
Justin Chu
Ranch Hand

Joined: Apr 19, 2002
Posts: 209
    
    1
Define "too much time".

With only 400 rows, if it is slow, it is more likely the overhead of creating a connection rather than the data transfer time.

Make sure you enable connection pooling. After that, check if your JDBC drivers are up to date, and the servers/network configuration.
[ January 30, 2007: Message edited by: Chu Tan ]
Allen Mathew Williams
Greenhorn

Joined: Jan 30, 2007
Posts: 8
Hi Shankar,
In addition to what Chu Tan sugested, access time to the database may also increase if you create too many connections and then dont close the connections, please make sure that you close all you connections, then with the correct drivers your access to the database should be quick.

Allen.
Allen Mathew Williams
Greenhorn

Joined: Jan 30, 2007
Posts: 8
Hi Shankar,
In addition to what Chu Tan sugested, access time to the database may also increase if you create too many connections and then dont close the connections, please make sure that you close all you connections, then with the correct drivers your access to the database should be quick.

Allen.
amrita sankar
Greenhorn

Joined: Jan 25, 2006
Posts: 26
Hi all

Thank you for your suggestions.
I havent closed the connections that i have opened before and that might be the problem

Sankar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database accessing time