aspose file tools*
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Another JSP Problem - Database related" Watch "Another JSP Problem - Database related" New topic
Author

Another JSP Problem - Database related

E Wong
Greenhorn

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:
if(addData){
ResultSet tableNames;
//dbmd = conn.getMetaData(); take out by poo take cater connection pool broken
String tblName="";
try {
if(sDTSourceType.equals("MSACCESS")){
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 (tableNames.next()){
tblName = tableNames.getString("TABLE_NAME");
vRow.add(tblName.trim());
}//end while
tableNames.close();
---------------

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
Greenhorn

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
thanks..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Moving to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
E Wong
Greenhorn

Joined: Sep 20, 2004
Posts: 6
managed to solve it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Another JSP Problem - Database related