File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Another JSP Problem - Database related Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Another JSP Problem - Database related" Watch "Another JSP Problem - Database related" New topic

Another JSP Problem - Database related

E Wong

Joined: Sep 20, 2004
Posts: 6
Hi all, i'm experiencing another problem on JSP which has really stumped me.
The problem i am encountering is as follows.

My current web application (Page A) allows me to pull a list of tables from a specific database (24/7 connectivity) and lists it out on a new page (Page B). However, if that specific DB is taken offline (restart,crash etc) somethings goes wrong with my db connection. I am still able to click submit an advance to "Page B" but there are no tables listed. If i am not mistaken, the connection is still "live" but there is something wrong with the metadata. Can anyone give me some insight on this problem?

A fragment of the codes are as follows:
ResultSet tableNames;
//dbmd = conn.getMetaData(); take out by poo take cater connection pool broken
String tblName="";
try {
String[] names = {"TABLE"};
dbmd = conn.getMetaData();//add by poo
tableNames = dbmd.getTables(null,null,null, names);
} else if(sDTSourceType.equals("MYSQL")){
String[] names = {"TABLE"};
dbmd = conn.getMetaData();
tableNames = dbmd.getTables(null,null,null, names);
} else {
String[] names = {"TABLE","SYNONYM"};
String uid = (String)request.getSession().getAttribute("UserID");
if (uid == null) {
uid = "%";
tableNames = aDbManager.getTables(null, "%", "%", names);
while ({
tblName = tableNames.getString("TABLE_NAME");
}//end while

In my situation, i'm using MSSQLType4 as the DB.

Hopefully someone can help.

Best regards,
E Wong

[ October 14, 2004: Message edited by: E Wong ]

[ October 14, 2004: Message edited by: E Wong ]
[ October 14, 2004: Message edited by: E Wong ]
indika prasad kularathne

Joined: Oct 14, 2004
Posts: 20
Hai dear..
close your all ResultSet u open and also Database connection.
eg: rs.close();//close resultset
conn.close();//close the connection
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63869

Moving to the JDBC forum.

[Asking smart questions] [About Bear] [Books by Bear]
E Wong

Joined: Sep 20, 2004
Posts: 6
managed to solve it
I agree. Here's the link:
subject: Another JSP Problem - Database related
It's not a secret anymore!