Solved

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

Posted on 2006-11-13
4
8,997 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java beans and EJBs 5 196
how to exclude a file using regex 5 122
tomcat startup error 5 104
jsp CRUD operations with and without prepared statement also hibernatge 1 11
ConnectWise and their customers need to ensure critical alerts automatically reach the right person at the right time. MSP superheros efficiently respond to these alerts key is providing automatic, intelligent alerting that generates a complete audi…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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