Skip to Content
0
Former Member
Nov 12, 2007 at 08:19 AM

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException

30 Views

hi all,

i got this error while connecting to my MSSQL database. My MSSQL database is already attach to the ODBC. but when i try to do a login page and run. it give me an error: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of dbname.

the following is my code:

//@@begin onActionGLogin(ServerEvent)

String name = wdContext.currentLoginElement().getUserID();

String password = wdContext.currentLoginElement().getPassword();

try{

Context ctx = new InitialContext();

DataSource ds = (DataSource)ctx.lookup("jdbc/dbname");

Connection con=ds.getConnection();

Statement st=con.createStatement();

ResultSet rs = st.executeQuery("Select * FROM FinanceOfficer WHERE userID = '"name"' AND password = '"password"';");

if(rs.next()== false){

wdComponentAPI.getMessageManager().reportException("Invalid UserID and Password!",true);

}else{

wdThis.wdFirePlugToBackEnd();

}

}catch (Exception e)

{wdComponentAPI.getMessageManager().reportException(e.toString(),true); }