摘要:
/-- - 带参查询 -/ public void pare(){ String sql = "select - from studentInfo where s_id = ?" ; try { ps = getConn().prepareStatement(sql); ps.setString(1, "张三"); //传参 rs = ps.executeQuery(); //需要注意ps.executeQ... 阅读全文
摘要:
import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;/-- - - 执行更新 - @param string - @param sql -/ public void execute(String sql){ try { stmt = getConn().createStatement(); stmt.executeUpdate(sql); //执行SQL语句增删改的方法 ... 阅读全文
摘要:
1 import java.sql.Connection; 2 import java.sql.DriverManager; 3 4 private static final String URI = "jdbc:oracle:thin:@localhost:1521:orcl"; 5 //驱动路径 6 private static final String USER = "testUser"; //数据库名 7 private static ... 阅读全文