JavaWorld@TW the best professional Java site in Taiwan sun training logo
      註冊 | 登入 | 全文檢索 | 排行榜  

» JavaWorld@TW » JDBC/SQL討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
作者 連oracle時 發生IO異常message
smalla22





發文: 7
積分: 0
於 2006-10-05 10:05 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list     收藏文章? del.icio.us||HEMiDEMi|Search 2.0
我要連上oracle 用JDBC run程式的時候 發生下面的erro message
java.sql.SQLException: IO 異常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093120)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

下面是我的程式
package j2src;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class conn {

  /**
   * @param args
   */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      Connection conn2 = DriverManager.getConnection("jdbc:oracle:thinAngrylocalhost:1521:orcl","user","password");
      Statement stmt2 = conn2.createStatement();
            
      // stmt2.executeUpdate("select * from employees");
      String sql2 = "select * from fncarrier";
      ResultSet rs = stmt2.executeQuery(sql2);
      while (rs.next()) {
      String col1 = rs.getString(1);
      String col2 = rs.getString(2);
      String col3 = rs.getString(3);
      System.out.print(col1 + ", ");
      System.out.print(col2 + ", ");
      System.out.println(col3);
      }
      
     rs.close();  
     stmt2.close();  
     conn2.close();  
     System.exit(0);  
     }
    
     catch (Exception e) {
     System.err.printlnEnvelope;  
     }

  
  }
}




作者 Re:連oracle時 發生IO異常message [Re:smalla22]
linexpmail

好玩就好



發文: 435
積分: 15
於 2006-10-05 10:32 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list     收藏文章? del.icio.us||HEMiDEMi|Search 2.0
12505 官方說法是 orcl 這個 sid 連不上,可能原因除了資料庫端設定外,
URL 寫錯或是用到不合的客端 jdbc driver 版本都有可能,參考看看。

http://www.orafaq.com/forum/t/4722/0/
http://forum.java.sun.com/thread.jspa?threadID=241605&messageID=880832




» JavaWorld@TW »  JDBC/SQL討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JavaWorld@TW


Powered by Powerful JuteForum® Version Jute 1.5.8
Copyright© 2002-2003 Rainman Zhu,Zua,Netboy,Scott. All Rights Reserved.