I can only need it in the JSP page.
Package DB;
Import java.sql. *;
Public class viewQuerybean {
Private dbconnection d;
Private resultset rset = NULL;
Public viewQuerybean () throws sqlexception {
D = new dbconnection ();
System.out.println ("db");
D.openConnection ();
}
Public ResultSet ExecuteQuery (String Query) THROWS SQLEXCEPTION {
Rset = d.ExceuteQuery (query);
Return Rset;
}
Public void executeUpdate (string query) throws sqlexception {
D.ExecuteUpdate (query);
}
Public void close () {
IF (d! = null) D. close ();
IF (Rset! = null) {
Rset = NULL;
}
}
Public void finalize () {
THIS.CLOSE ();
Public int getRowcount () {
Try {
This.Rset.last ();
Return this.rset.Getrow ();
}
Catch (Sqlexception EX) {
Return 0;
}
}
Public int getColumncount () {
Try {
ResultSetMetadata RSMD = RSET.GETMETADATA ();
Return RSMD.GetColumnCount ();
}
Catch (Sqlexception EX) {
Return 0;
}
}
Public string getString (int index) {
Try {
Return Rset.getstring (INDEX);
}
Catch (Sqlexception EX) {
Return NULL;
}
}
Public string getString (String ColumnName) {
Try {
Return Rset.getstring (columnname);
}
Catch (Sqlexception EX) {
Return NULL;
}
Public string getColumnname (int index) {
Try {
ResultSetMetadata RSMD = RSET.GETMETADATA ();
Return RSMD.GetColumnLabel (INDEX)! = NULL? RSMD.GetColumnlabel (Index): ""
}
Catch (Sqlexception EX) {
Return NULL;
}
}
Public boolean next () {
Try {
Return Rset.next ();
}
Catch (Exception EX) {
Return False;
}
}
Public Object getObject (int index) {
Try {
Return Rset.GetObject (Index);
}
Catch (Sqlexception EX) {
Return NULL;
}
}
Public void absolute (int i) {
Try {
this.rset.absolute (i);
}
Catch (Sqlexception EX) {EX.PrintStackTrace ();
}
Public ResultSet getResultSet () {
Return this.rset;}
}