File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

java error while quering db in jsp

monica acerra
Greenhorn

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.
ERROR:
JAVA caused an invalid page fault in
module <unknown> at 0000:1f43b3f0.

Please advise!!
TIA
Monica
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
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(columns.next()) {
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.
regds
maha anna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java error while quering db in jsp
 
Similar Threads
delete tag
jsp connection to access db
SQL and JSP
Tomcat/MS Access and Tomcat keeps dying
Cursor not in ResultSet Proximity