Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.sql.SQLException: Io exception: Connection refused

Status
Not open for further replies.

lovekang

Programmer
Feb 16, 2006
86
0
0
KR
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.

public class DBConnectionManager {
static Connection oConn = null;
public static synchronized Connection getConnection() {
...
...
...
Class.forName("oracle.jdbc.driver.OracleDriver");
oConn = DriverManager.getConnection("jdbc:eek:racle:thin:mad: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.
...
...
}
}
 
Looks like you connection string is a bit odd.

It should be something like :

oConn = DriverManager.getConnection("jdbc:eek:racle:thin:mad:SERVERNAME:1521:SID" , "auser", "apassword");

where you need to replace SERVERNAME with the real machine name, and SID with your oracle sid that is on that server.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top