每当我在代码中使用无限循环时,我都会得到ORA-12519不合适的服务处理程序-异常。但是,这段代码在其他系统中工作得很好。
这是我的密码
public static void main(String args[]) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String dbHost = "localhost";
String database = "scott";
String dbUsername = "scott";
String dbPassword = "scott";
String smsReceiver = "";
String dbUrl = "jdbc:oracle:thin:@localhost:1521:xe";
while (true) {
ResultSet rs = null;
conn = DriverManager.getConnection(dbUrl, dbUsername, dbPassword);
try {
Statement smnt = null;
smnt = conn.createStatement();
String sql = "select count(*) from ozekismsin";
rs = smnt.executeQuery(sql);
rs.next();
int count = rs.getInt(1);
if (count != 0) {
System.out.println("success");
sql = "select * from ozekismsin";
rs = smnt.executeQuery(sql);
rs.next();
String msg = rs.getString("msg");
// smsReceiver=rs.getString("sender");
System.out.println(msg);
StringTokenizer st = new StringTokenizer(msg, " ");
st.nextToken();
String source = st.nextToken();
st.nextToken();
String dest = st.nextToken();
System.out.println(source + " " + dest);
PreparedStatement preparedStatement = null;
sql = "select id from new1 where name=?";
preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, source);
rs = preparedStatement.executeQuery();
rs.next();
int s = rs.getInt("id");
System.out.println(source + " " + dest);
sql = "select id from new1 where name=?";
preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, dest);
System.out.println(s);
rs = preparedStatement.executeQuery();
rs.next();
int d = rs.getInt(1);
a = s;
test1 ob = new test1();
ob.dijkstra(s, d);
String sqlInsert = "INSERT INTO "
+ "ozekismsout (receiver,msg,status) "
+ "VALUES " + "('" + smsReceiver + "','"
+ message + "','send')";
if (smnt.executeUpdate(sqlInsert) != 0) {
System.out.println("OK");
System.out.println(message);
} else {
System.out.println("ERROR");
}
sql = "delete from ozekismsin";
smnt.executeQuery(sql);
sql = "commit";
smnt.executeQuery(sql);
} // end of if
smnt.close();
conn.close();
} // end of try in while
finally {
try {
rs.close();
} catch (Exception e) {
System.out.println("exception caught");
}
} // end of finally
} // end of while
} // end of outer try
catch (Exception ex) {
System.out.println("Exception: " + ex.getMessage());
ex.printStackTrace();
}
} // end of main这段代码在其他系统中工作得很好。但在这里,只有当我移除无限循环时,它才能工作。
请大家帮帮我。
发布于 2015-04-07 21:11:31
错误ORA-12519可能是由当前连接使用(例如concurrernt会话)超出了Oracle实例允许的最大数量所引起的。
让您的DBA告诉您哪些连接限制是强制的--这些设置是特定于数据库的,有些值有默认值。问。
正如您的代码循环@AlexPoole指出的那样,您正在耗尽资源--例如,您可能正在创建一系列连接,而不是释放它们。我不能确定。12519错误是连接资源问题。句号。你是怎么做到的我不知道。
https://stackoverflow.com/questions/29495707
复制相似问题