标题:谁知道这到底是怎么回事,java连接oracle数据库,在eclipse下已经引入class ...
取消只看楼主
飞黄腾达
Rank: 2
等 级:论坛游民
帖 子:46
专家分:27
注 册:2013-3-14
结帖率:29.41%
已结贴  问题点数:20 回复次数:0 
谁知道这到底是怎么回事,java连接oracle数据库,在eclipse下已经引入classes12.jar包了,还是不行,真么郁闷
package student;
import java.lang.*;
import java.sql.*;
public class JDBCoracle{
   
        
        public static final String driverClassName = "oracle.jdbc.driver.OracleDriver";
        public static final String url = "jdbc:oracle:thin:@localhost:1521:orcl";
        public static final String password = "472312";
        public static final String user= "sys as sysdba";
        public static void main(String[] args) throws Exception{
             Connection conn = null;
             Class.forName(driverClassName);
             conn = DriverManager.getConnection(url, user, password);
            System.out.println(conn);
            conn.close();
            
         
        }
    }
错误异常:
Exception in thread "main" java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:345)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:428)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:515)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:345)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at student.JDBCoracle.main(JDBCoracle.java:14)

搜索更多相关主题的帖子: localhost password package oracle public 
2013-10-26 19:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-422565-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.296425 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved