Results 1 to 10 of 10
Thread: code login
- 11-28-2008, 05:47 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 6
- Rep Power
- 0
code login
hey guys!
here is the code for logging in that keeps giving a null pointer exception.
Can u guys figure out the problem 4 me?
Class.forName("com.mysql.jdbc.Driver");
conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","");
ps = (PreparedStatement) conn.prepareStatement("SELECT UserName,Password,Domain FROM user_details WHERE UserName=?");
ps.setString(1,CurrentUser);
ResultSet rset = ps.executeQuery();
rseto = rset.getMetaData().getColumnCount();
while(rset.next()){
for(int i=0;i<=3;i++)
carer[0] = (String)rset.getObject(i);
}
if(carer[1].equals(CurrentUser) && carer[2].equals(password) && carer[3].equals(selectDomain)){
JOptionPane.showMessageDialog(null,"Welcome to Express Fleet Management.");
firstInterface f = new firstInterface();
f.setVisible(true);
this.dispose();
}else
JOptionPane.showMessageDialog(null,"Either your user name,password or domain is incorrect.Please try again.");
conn.close();
- 11-28-2008, 07:43 PM #2
What is the full error or exception output?
- 12-02-2008, 12:34 PM #3
Member
- Join Date
- Nov 2008
- Posts
- 85
- Rep Power
- 0
Re:
Hi,
If u pass null value in sql means,u will get the NullPointerException.
- 12-02-2008, 01:00 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
NullPointerException means you found a null value at runtime in your application. Did you try to debug and see what happen there?
- 12-02-2008, 01:14 PM #5
Member
- Join Date
- Nov 2008
- Posts
- 85
- Rep Power
- 0
Re:
Hi,
Ya,Null Pointer Exception means found null value at runtime.
- 12-02-2008, 01:15 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
- 12-02-2008, 01:18 PM #7
He wants to become a star hero of the forum.
- 12-02-2008, 01:22 PM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
- 12-02-2008, 01:24 PM #9
Sure and some of them are similar to yours ones.
- 12-02-2008, 01:26 PM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Those are things useless actually, saying the same thing. I have to keep eye on him ;)
Similar Threads
-
mySQL login code??
By sweet angle in forum JDBCReplies: 3Last Post: 10-20-2010, 10:42 AM -
login.jsp
By roo7 in forum Enterprise JavaBeans (EJB)Replies: 5Last Post: 12-02-2008, 04:58 PM -
Login Forms
By dankonsoer in forum New To JavaReplies: 1Last Post: 08-07-2008, 01:06 PM -
cannot open database requested in login. Login fails
By banduskank in forum JDBCReplies: 0Last Post: 06-25-2008, 01:41 PM -
I want to get values from login jsp
By trill in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 08-07-2007, 08:33 AM
Bookmarks