Thread: SQL Error
View Single Post
Old 12-28-2011, 01:22 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
And what is the error you are receiving?

You may as well simplify this as well by making it a prepared statement. Prepared statements have many advantages over standard statements.

Code:
String username = "abc";
String sqlText  = "select CustId, CustLoginId, CustPassword from javaDB.Customer where custLoginId = ?";

PreparedStatement stmt = conn.prepareStatement(sqlText);
stmt.setString(1, username);
ResultSet rs = stmt.executeQuery();
Fou-Lu is offline   Reply With Quote