- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.Statement;
- public class Test{
- public static void main(String[] args) {
- String driver="oracle.jdbc.driver.OracleDriver";
- String url="jdbc:oracle:thin:@127.0.0.1:1521:Test";
- String userName="username";
- String password="users";
- Connection conn;
- Statement st;
- String sql="";
- try{
- Class.forName(driver);
- conn = DriverManager.getConnection (url,userName,password);
- st = conn.createStatement();
- sql ="create table A(c1 number)";
- sql ="select * from table";
- sql = "insert into QuestionsManager.questions values('"+啊+"')";
- sql = delete from Test" +"where id in (select top 1 id from Test)
- pstmt = dbc.getConnection().prepareStatement(sql) ;
- pstmt.setString(1,"%"+cond+"%") ;
- pstmt.setString(2,"%"+cond+"%") ;
- pstmt.setString(3,"%"+cond+"%") ;
- sql = update from Test" + "where id in (select top 1 id from Test_DB)
- sql = update Test set column" + "(select column from Test where Test.column1 = Test2.column1)
- st.execute(sql);
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
复制代码 |
|