Problem Accessing databases

I'm trying to validate data from a Database, matching a textbox with the data in a table, I made this with Derby using the example that comes with the documentation, It works fine with the example, but my problem is that I can't use another database, I try to access from Oracle, from SQLServer and the result is the same, I obtain a NullPointerException.

I use this code:

CachedRowSetDataProvider employeeDataProvider =getSessionBean1().getEmployeesDataProvider();

CachedRowSetXImpl employeeRowSet =getSessionBean1().getEmployeesRowSet();

employeeDataProvider.setCursorRow(

employeeDataProvider.findFirst("EMPLOYEE.LASTNAME", txtUser.getValue()));

let's say that all the code is good, but the problem comes when I compare the data:

if (correctName.equals(txtUser.getValue()) && correctPassword.equals(txtPass.getValue()))

{

JOptionPane.showMessageDialog(null, "Bienvenido a CPS ");

return "login";

I obtain the message that I said before.

java.lang.NullPointerException

If I put a table and drop the data into the table, I can see the data.

Please help me.

[1162 byte] By [ivan_cervantes] at [2007-11-26 8:48:20]
# 1

SInce this a Web Application, you replace this:

JOptionPane.showMessageDialog(null, "Bienvenido a CPS ");

with:

info("Bienvenido a CPS ");

** This info statement should be in the new login page. A message group component should be avaiable on this page, to be able to show up the info message.

Regards,

Sakthi

sakthivelgopal at 2007-7-6 22:36:37 > top of Java-index,Development Tools,Java Tools...
# 2
the code to show a JOptionPane is just to see if I can obtain the access, but the problem persist if I take it away, the only thing that I need is verify the text that I write in a text box with the data in a table in the database.Thanks.
ivan_cervantes at 2007-7-6 22:36:37 > top of Java-index,Development Tools,Java Tools...
# 3

You'll have to look at your NPE stack trace and find out which statement generates the NPE.

I guess, that this might return null:

employeeDataProvider.findFirst("EMPLOYEE.LASTNAME", txtUser.getValue())

Some databases/drivers would need just columnName instead of tableName.columnName.

HTH,

Sakthi

sakthivelgopal at 2007-7-6 22:36:37 > top of Java-index,Development Tools,Java Tools...