JSP tutorial connecting to the Oralce database tutorial and displaying records
public class Userdao {
PRIVATE Connection conn = null;
private Statement st = null;
Public Userdao () {
try {
Class.forName ("Oracle.jdbc.driver.OracleDriver"). newinstance ();
conn = DriverManager
. getconnection
("Jdbc:oracle:thin:@192.168.1.107:1521:zhuh",
"Zucc", "123456");
catch (Exception ex) {
Ex.printstacktrace ();
}
}
Public synchronized void release () {
if (St!= null) {
try {
St.close ();
catch (Exception e) {
}
}
IF (conn!= null) {
try {
Conn.close ();
catch (Exception e) {
}
}
}
Public Synchronized boolean checkuser (Actfrmusers user) throws exception{
Boolean bl=false;
&nb Sp try{
st = conn.createstatement ()//This sentence is placed here
ResultSet rs=st.executequery ("SELECT * from users");
while (Rs.next ()) {
System.out.print ("QW");
}
catch (Except Ion ex) {
ex.printstacktrace ();
throw new Exception ("Database query Error");
}
return BL;
}
}