Thread: SQL Error
View Single Post
Old 12-28-2011, 08:04 AM   PM User | #1
sam71
New to the CF scene

 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sam71 is an unknown quantity at this point
SQL Error

I am new to Java and getting a run time error in sql statement in the java code.

Below is the test code. I want to select the row from CUSTOMER table where CUSTLOGINID = "abc"
Code:
String username = "abc";
String sqlText  = "select CustId, CustLoginId, CustPassword from javaDB.Customer where custLoginId = ";

stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sqlText + " '+username+' ");
Please advice what is wrong in above code.

Thanks
sam71 is offline   Reply With Quote