hi guys.. im new on this forum so i dont really know if i should post this topic at the
Java beginner's
thread or here..
Anyway, i am new in studying java and java
servlet. i am primarily interested with JBDC and java servlet's interaction and linkage. currently, i am doing some hands-on experiment using microsoft access as my
testing database. Here's a snippet of my code..(warning: they may look really crude..but i hope you will bear with my limited coding experience using servlet).
I have defined a datasource called 'test' that points to my test database.
// connecting to database
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc

dbc:test");
stmt = con.createStatement();
ResultSet usrName = null;
String myname = "Renee";
String sqlstmt =
"SELECT userID from userlist where username = " + myname; usrName = stmt.executeQuery(sqlstmt);
while(usrName.next()) {
out.print(usrName.getObject(1).toString());
out.print("\n");
}
A simple 'Select statement' works fine. but as soon as i include the 'where clause' i always get this problem ..java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Please help...