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("jdbcracle:thinurl: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.
...
...
}
}
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("jdbcracle:thinurl: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.
...
...
}
}