java.sql.SQLException:Io 异常:The Network Adapter could not establish the connection刚安装的oracle 写的DB就执行出这个错,package db;import java.sql.Connection;import java.sql.DriverManager;public class DB {\x05Connection conn;\x05public

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 04:46:19
java.sql.SQLException:Io异常:TheNetworkAdaptercouldnotestablishtheconnection刚安装的oracle写的DB就执行出这个错,pack

java.sql.SQLException:Io 异常:The Network Adapter could not establish the connection刚安装的oracle 写的DB就执行出这个错,package db;import java.sql.Connection;import java.sql.DriverManager;public class DB {\x05Connection conn;\x05public
java.sql.SQLException:Io 异常:The Network Adapter could not establish the connection
刚安装的oracle 写的DB就执行出这个错,
package db;
import java.sql.Connection;
import java.sql.DriverManager;
public class DB {
\x05Connection conn;
\x05public Connection getConn() {
\x05\x05return conn;
\x05}
\x05public DB(){
\x05\x05String driver="oracle.jdbc.driver.OracleDriver";
\x05\x05String url="jdbc:oracle:thin:@localhost:1521:orcl";
\x05\x05
\x05\x05try {
\x05\x05\x05Class.forName(driver);
\x05\x05\x05conn=DriverManager.getConnection(url,"scott","tiger");
\x05\x05\x05System.out.println(conn);
\x05\x05} catch (Exception e) {
\x05\x05\x05e.printStackTrace();
\x05\x05}
\x05}
\x05public static void main(String[] args) {
\x05\x05new DB();
\x05}
}
连不上数据库,这个该怎么解决啊难道是权限问题?

java.sql.SQLException:Io 异常:The Network Adapter could not establish the connection刚安装的oracle 写的DB就执行出这个错,package db;import java.sql.Connection;import java.sql.DriverManager;public class DB {\x05Connection conn;\x05public
数据库连不上