I created one Swing project in Java 8 and I used Oracle 10g for database connectivity. Everything is fine but when I run my project then after few operations i am getting following error:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:xe
I have used following query in oracle database :-
alter system set processes=300 scope=spfile;
But it's not working still number of processes is 40:-
RESOURCE_NAME processes
CURRENT_UTILIZATION 39
MAX_UTILIZATION 40
INITIAL_ALLOCATION 40
LIMIT_VALUE 40
What should I do?
Hello I am using following code for connection:-
package connection;
import java.sql.*;
public class conn {
Connection con;
Statement st;
ResultSet rs;
public ResultSet GetData(String s) {
try{
Class.forName("oracle.jdbc.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "123456");
st=con.createStatement();
//System.out.println("Connected to DataBase to show the result...");
rs=st.executeQuery(s);
}
catch(Exception e)
{
System.out.println(e);
}
return rs;
}
public void UpdateData(String s) {
try
{
Class.forName("oracle.jdbc.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "123456");
st=con.createStatement();
//System.out.println("Connected to the DataBase for Updating the Record...");
st.executeUpdate(s);
System.out.println("Record Updated...");
}
catch(Exception e1)
{
System.out.println(e1);
}
}
}
These codes are in seperate class now when ever i want to use the database connectivity in project i am just creating a object of this class and using a functions. In my project i am using timer as well to refresh data of JTable. Please kindly provide solution ?
Its Resolved now. Thank You so much to all for your support. It was happening because i didn't close connection in database connectivity class which i have mentioned in my question and codes. every time when timer start then it creates new instance of database connectivity class without closing old one. Now i created close method in the connection class and every thing is fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.