In login page i make validation that user is allowed to enter system , i make methode which validate user:
boolean isValidUser(Connection con,String userName,String pass ){}
it works correctly in desktop Application, but when i tried it in servlet it makes exception that table or view doesn't exist ??? but the table is aleady exist in my db ?? Can somebody tell me where is the problem?
this is the method
public boolean isValidUser(Connection con,String userName,String pass )throws SQLException
{
String selSQL="SELECT USER_NAME, USER_PASS FROM OSQS_USERS where USER_NAME =? and USER_PASS =?";
ResultSet rs =null;
boolean exist =false;
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement(selSQL);
pstmt.setString(1,userName);
pstmt.setString(2, pass);
rs=pstmt.executeQuery();
if(rs.next())
exist= true;
}
//close statment and result sest
return exist;
}
If Oracle is telling you that a table or view "does not exist", then it is telling you that it cannot find them ... even if you think that it should find them.
I would hazard a guess that you are connecting to a different Oracle database when running in your desktop application and in a servlet. This may be by design or by accident.
Take a look at your respective JDBC configurations; specifically the connection URLs.
(It is also possible that this is a permissions problem. But I'd have thought that Oracle would tell you that you don't have permission to use the table or view ... rather than telling you that it doesn't exist.)
EDIT
I suspect that the root problem is that the 'localhost' in the JDBC URL is sending you to different hosts (and hence Oracle database servers) in the desktop and servlet cases. Try using the actual DNS name of the server that contains the database you are trying to use.
You should be asking your local database administrator that question!