| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 7315 人关注过本帖
标题:java代码连接Oracle数据库出错,求解,以下是错误信息
取消只看楼主 加入收藏
bcyu
Rank: 2
等 级:论坛游民
帖 子:39
专家分:56
注 册:2011-5-9
结帖率:100%
收藏
已结贴  问题点数:100 回复次数:2 
java代码连接Oracle数据库出错,求解,以下是错误信息
import java.sql.*;

public class Test {
    public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver" ;
    public static final String DBURL = "jdbc:oracle:thin:@localhost:1158:mldn" ;
    public static final String DBUSER = "scott" ;
    public static final String DBPASS = "tiger" ;
   
    public static void main(String[] args) {
        Connection conn = getConnection();
        if (conn != null) {
            System.out.println("success!");
        } else {
            System.out.println("error!");
        }
    }
   
    public static Connection getConnection() {
        Connection conn = null;
        
        try {
            Class.forName(DBDRIVER);
        } catch (ClassNotFoundException e) {
        //    e.printStackTrace();
        }
        
        try {
            conn = DriverManager.getConnection(DBURL, DBUSER, DBPASS);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        
        return conn;
    }
}

java.sql.SQLException: Got minus one from a read call
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at Test.getConnection(Test.java:28)
    at Test.main(Test.java:10)
Caused by: Got minus one from a read call
    at (Packet.java:285)
    at (NSProtocol.java:286)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
    ... 8 more
error!


搜索更多相关主题的帖子: java 数据库 Oracle 错误信息 
2011-08-12 00:48
bcyu
Rank: 2
等 级:论坛游民
帖 子:39
专家分:56
注 册:2011-5-9
收藏
得分:0 
帮忙回答啊,朋友们》。。。
2011-08-12 13:56
bcyu
Rank: 2
等 级:论坛游民
帖 子:39
专家分:56
注 册:2011-5-9
收藏
得分:0 
嗯嗯,谢谢各位,以解决......
2011-08-13 19:30
快速回复:java代码连接Oracle数据库出错,求解,以下是错误信息
数据加载中...
 
   



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

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