您好,欢迎访问一九零五行业门户网

java连接oracle 跟 mysql 的例子

java连接oracle 和 mysql 的例子 @test public void oravledemo() throws exception { class.forname(oracle.jdbc.driver.oracledriver); string url = jdbc:oracle:thin:@localhost:1521:库名; connection conn = drivermanager.getconnection(url, use
java连接oracle 和 mysql 的例子
@test
public void oravledemo() throws exception {
    class.forname(oracle.jdbc.driver.oracledriver);
    string url = jdbc:oracle:thin:@localhost:1521:库名;
    connection conn = drivermanager.getconnection(url, username, password);
    statement stmt = conn.createstatement();
    resultset rs = stmt.executequery(select * from so_t_enterprise where se_i_id = );
    while (rs.next()) {
    rs.getstring(字段名);
    }
            conn.close();
}
@test
public void oravledemo() throws exception {
    class.forname(com.mysql.jdbc.driver);
    string url = jdbc:mysql://localhost:3306/库名;
    connection conn = drivermanager.getconnection(url, username, password);
    statement stmt = conn.createstatement();
    string sqlparse =insert into tablr(id) values (1);
    stmt.execute(sqlparse);
            conn.close();
}
其它类似信息

推荐信息