Solved

java.sql.SQLException: Io exception: Connection refused(DESCRIPTION

Posted on 2006-11-13
4
9,030 Views
Last Modified: 2011-08-18
I got the error message below from logs.
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153092352)(ERR=12519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))
....
...
..

it says that usually this is because SID is incorrect.
in my case this not the case. usually it works ok but sometimes it won't work.
even though the web application doesn't work oracle client, for example, toad can connect and crud data.

I think this is because of my code below.

unfortunately i don't know how to get connections and release them in j2ee.

any ideas?
articles and books do you have in mind?

thanks.


jdk 1.4
tomcat 5.0
oracle 9i
windows 2000

public class DBConnectionManager {
  static Connection oConn = null;
  public static synchronized Connection getConnection() {
    ...
    ...
    ...
    Class.forName("oracle.jdbc.driver.OracleDriver");
    oConn = DriverManager.getConnection("jdbc:oracle:thin:@url:1521:sdstock" , "auser", "apassword");
    return oConn;
  }
}

public class ClientsOfTheConnection{
  private Connection conn;
  public ClientOfTheConnection(){
    conn = DBConnectionManager.getConnection();
  }
  public void dbManupulation(){// CRUD
    ...
    ...
    pstmt = conn.prepareStatement(sql);
    rs = pstmt.executeQuery();
    rs.close();
    pstmt.close();
    //do not close conn.
    ...
    ...
  }  
}
0
Comment
Question by:iamjhkang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 17936523
Have you tried using the DBCP rather than your own connection manager?

http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html#Oracle%208i%20with%20OCI%20client
0
 
LVL 9

Assisted Solution

by:owenli27
owenli27 earned 125 total points
ID: 17939331
- Your codes look like OK.  If you could connect DB by using TOAD without problem,  verify your code connect string against tnsnames.ora.
- Make sure that you are using correct oracle JDBC driver. (http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html)

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question