import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class OrclConnection {
/**
* @param args
*/
public static void main(String[] args) {
OrclConnection orcl = new OrclConnection();
try {
orcl.getData();
} catch (SQLException e) {
e.printStackTrace();
}
}
public Connection getConn() throws SQLException {
// 声明数据库链接
Connection conn = null;
// 声明数据库连接URL并初始化
String strURL = "jdbc:oracle:thin:@localhost:1521:orcl";
// 声明数据库连接用户并初始化
String strUser = "scott";
// 声明数据库连接用户对应密码并初始化
String strPassword = "orcl";
try {
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载