当前位置:   article > 正文

Java连接oracle 删除,Java操作Oracle数据库(建表,插数据,删除)-JSP教程,Java技巧及代码...

java两个接口对oracle同一条数据进行删除操作

import java.net.url;

import java.sql.*;

public class create {

public create() {

}

public static void main(string[] args){

string url = "jdbc:oracle:thin:@10.0.1.3:1521:sdcdb";

string query = "create table myfirst" + "(id int,name char(10))";

string sql="insert into myfirst values(1,liming)";

string sql1="insert into myfirst values(2,mm)";

string sql2="delete myfirst where id=2";

try

{

class.forname("oracle.jdbc.driver.oracledriver");

connection conn = drivermanager.getconnection(url, "test", "test");

statement stmt = conn.createstatement();

stmt.executeupdate(query);

stmt.executeupdate(sql);

stmt.executeupdate(sql1);

stmt.executeupdate(sql2);

system.out.println("create success!");

stmt.close();

conn.close();

}

catch(java.lang.classnotfoundexception e){

system.err.print(e.getmessage());

}

catch(sqlexception ex){

system.out.println("\n***sqlexception caught ***\n");

}

}

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/387281
推荐阅读
相关标签
  

闽ICP备14008679号