• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Another JSP Problem - Database related

 
E Wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
E Wong
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
managed to solve it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic