JDBC連Oracle資料庫

2021-04-13 08:51:12 字數 659 閱讀 7603

string drivername = "oracle.jdbc.driver.oracledriver";

string url = "jdbc:oracle:thin:@172.28.139.78:1521:oracts";

string username = "scott";

string password = "tiger";

try

else

//statement stmt = conn.createstatement();

preparedstatement stmt = conn.preparestatement("select * from emp where empno like ?");

//resultset rs = stmt.executequery("select * from emp ");

stmt.setstring(1,"10%");

resultset rs = stmt.executequery();

while(rs.next())

conn.commit();

rs.close();

stmt.close();

conn.close();

} catch (exception e)  

Jdbc連各種資料庫

1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl 為資料庫的 sidstri...

JDBC 連線 Oracle資料庫

今天做了一下jdbc連線oracle資料庫的實驗。先是,客戶端oracle程式打不開,原來是因為windows7.把程式的相容性開啟,選上windows xp就能夠launch了 然後,在測試連線時,jar包在客戶端的jdbc lib下就可以找到 連線完成,就可以開始新建web project了。按...

JDBC連線Oracle資料庫

drivermanager.registerdriver new oracle.jdbc.oracledriver connection conn null conn drivermanager.getconnection url,user,password 1 簡單語句 string sql se...