Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

prepareStatement(String) HANGS! HELP! 10 dukes!

843854May 20 2002 — edited Jun 6 2003
I run 6 rmi servers as a middle tier for applet / database communication.. 5 run great for months at a time, only going down when I restart them (ie new release).. I dont know what's going on with #6, i get to the line where the statement prepares, and it hangs forever..

I have a high priced Oracle DBA that swears there's no waiters / blockers / locks on anything, NOTHING is wrong on the db side.. On the rmi server, there's no exceptions, no nothing! I put try/catch'es around every method in the entire server, and no exceptions are being thrown.. I get the System.out in the constructor, the server starts fine..

After this mysterious freeze, NO statements in ANY methods will prepare.. I can run methods on the server, and as long as theye dont try to access the databse, I'm fine, everything is great.. The only fix I know of is to kill the process and restart the server..

Here's relevant code:
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class AppImpl extends java.rmi.server.UnicastRemoteObject implements AppFactory {

    static OracleConnection jdbcConn;

    public AppImpl() throws java.rmi.RemoteException {
        jdbcConn = (OracleConnection)DriverManager.getConnection
                           ("jdbc:oracle:thin:@"+oracleIP+":orcl","oracleUser","oraclePassword");
        System.out.println("Connections Established");
    }
    
    public User getUserFor(String login, String pw){
            java.sql.PreparedStatement cstmt = null;
            java.sql.ResultSet rs = null;
            try{
                String stm="select whatever from users where login=? and pw=?
                System.out.println("Preparing statement..");  /////////////I SEE THIS LINE
                cstmt = AppImpl.jdbcConn.prepareStatement(stm);
                //////////////////////DOESN'T GET PAST HERE DURING FREEZE
                System.out.println("cstmt prepared, setting bind var's");  ////////I DO NOT SEE THIS ONE
                cstmt.setString(1, login);
                cstmt.setString(2, pw);
                System.out.println("binds set, executing cstmt....");
                rs = cstmt.executeQuery();
             }catch(java.sql.SQLException e){  }
             //stuff to create user class I return...
             return user;
    }

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2003
Added on May 20 2002
39 comments
1,955 views