It's not a secret anymore!
The moose likes Servlets and the fly likes java error while quering db in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "java error while quering db in jsp" Watch "java error while quering db in jsp" New topic

java error while quering db in jsp

monica acerra

Joined: Mar 26, 2001
Posts: 6
This code is querying the database, diplaying requested infor on page, and then shutting down tomcat everytime I run the page.
JAVA caused an invalid page fault in
module <unknown> at 0000:1f43b3f0.

Please advise!!
java.sql.Connection connection = java.sql.DriverManager.getConnection(
"jdbc dbc:ma");
java.sql.Statement statement = connection.createStatement();
java.sql.ResultSet columns = statement.executeQuery(
"SELECT * FROM url");
while( {
String name = columns.getString("name");
String url = columns.getString("url");
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Did you close all database resources properly at end? Connection,Statement,ResultSet etc. Also Each and everytime you request this jsp you are doing all database operation from scratch, start from loading the driver,getting connection,etc. It may not be a good idea for production purposes.
Try to create a connection pool and put this pool in session, whenever you need a database connection just get one from this pool, use it, after use free/return to pool.
maha anna
I agree. Here's the link:
subject: java error while quering db in jsp
It's not a secret anymore!