用myeclipse 怎样连接 远程oracle数据库 200
展开全部
参考下面代码及说明
public class BaseDAO {
public static String DRIVER="oracle.jdbc.driver.OracleDriver";
public static String URL="jdbc:oracle:thin:@主机Ip:1521:orcl";
public static String USER="用户名 ";//数据库的用户名,如admin
public static String PASSWORD="密码";//进入数据库的密码,如123
public Connection getConnection(){
Connection conn=null;
try {
Class.forName(DRIVER);
conn=DriverManager.getConnection(URL,USER,PASSWORD);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
}
public class BaseDAO {
public static String DRIVER="oracle.jdbc.driver.OracleDriver";
public static String URL="jdbc:oracle:thin:@主机Ip:1521:orcl";
public static String USER="用户名 ";//数据库的用户名,如admin
public static String PASSWORD="密码";//进入数据库的密码,如123
public Connection getConnection(){
Connection conn=null;
try {
Class.forName(DRIVER);
conn=DriverManager.getConnection(URL,USER,PASSWORD);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询