| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 697 人关注过本帖
标题:谁知道这到底是怎么回事,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
快速回复:谁知道这到底是怎么回事,java连接oracle数据库,在eclipse下已经引入 ...
数据加载中...
 
   



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

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