📄 prepstmt.java
字号:
import java.sql.*;
public class PrepStmt{
public static void main(String[] args){
try{
new oracle.jdbc.driver.OracleDriver();//另外一种注册驱动程序的方法
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora9","scott","tiger");
PreparedStatement pstmt=conn.prepareStatement("insert into dept values(?,?,?)");
pstmt.setInt(1,23);
pstmt.setString(2,"Kit");
pstmt.setString(3, "hi");
pstmt.executeUpdate();
pstmt.close();
conn.close();
}catch(SQLException e){
System.err.println(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -