While executing update by jdbc on Oracle dbms, my program hangs. I think it is waiting for another process/user to release lock on the rows or table that I am trying to update. So what are the possible causes for this problem and how can I solve it?
I am making calls to the dbms through jdbc as show here:
  public static void updateEmployee(String name,int id) throws ClassNotFoundException
{
    Connection con=null;
    PreparedStatement st=null;
    String driver= "oracle.jdbc.driver.OracleDriver";
    String username="someuser";
    String password="pwd";
    String url="jdbc:oracle:thin:@hostname:1521:ORAJAVADB";
    Class.forName(driver);
    try
    {
        con=DriverManager.getConnection(url,username,password);
        st=con.prepareStatement("update employee set employeeName=? where 
        employeeId = ? ");
        st.setString(1,name);
        st.setInt(2,id);
        st.executeUpdate();
        st.close();
        con.close();
    }
    catch(SQLException ex)
    {
    }
}
 
     
    