JDBC

xiaoxiao2021-03-06  38

String s = "ss";

String S1 = "ab";

String DRV = NULL;

Connection conn = NULL;

Statement Stmt = NULL;

ResultSet RS = NULL;

INT rowcount = 0;

Properties P = new profment ();

The Try {// Register the database driver for Oracle Drive Class.Forname ("Oracle.jdbc.driver.Driver.Driver.Driver.Driver);} catch (java.lang.classnotnotfoundexception e) {// This way is to facilitate debugging programs, error printing MYDB () I know where I have an error in system.rr.println ("mydb ():" E.getMessage ());}

Try {conn = drivermanager.getConnection ("JDBC: Oracle: Thin: @ 127.0.0.1: 1521: ORC8i", "Java", "88888888");} catch (sqlexception ex) {system.err.println ("conn: " ex.getMessage ());

IF (conn! = null) System.out.Println; Else System.Out.println ("Connection Failure");

Try {stmt = conn.createstatement ();

} Catch (sqlexception ex) {system.err.println ("CreateStatement (); ex.getMessage ());

}

Try {r = stmt.executeQuery ("Select * from userdata);

} Catch (sqlexception ex) {system.err.println ("stmt.excutequery ();" ex.getMessage ());

}

Try {while (rs.next ()) {

System.out.println ("UserName:" rs.getstring (1)); System.out.Println ("Password:" rs.getstring (2)); System.out.Println ("Email:" RS .getstring (3));

}

} Catch (sqlexception ex) {system.err.println ("a error is failure" ex.getMessage ());

}

转载请注明原文地址:https://www.9cbs.com/read-66289.html

New Post(0)