I've tested the JDBC-ODBC connection, its working fine , its just the SQL command....(i thk)
2003-06-17 10:47:48 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT I
NTO statement.
import java.sql.*;
public class RegisterHandler extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException, IOException {
String url = "jdbc
dbc:login";
Connection con;
String compareString;
String name = req.getParameter("name");
String account = req.getParameter("account");
String password = req.getParameter("password");
compareString = "SELECT login_id FROM login-table" +
" WHERE login_id == account)";
PrintWriter out = res.getWriter();
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection url, "", "");
stmt = con.createStatement();
String INSERT =
"INSERT INTO login-table (login_id ,password ,name) " +
"VALUES (?, ?, ?)";
PreparedStatement pstmt = null;
pstmt = con.prepareStatement(INSERT);
pstmt.setString(1, account);
pstmt.setString(2,password);
pstmt.setString(3,name);
pstmt.executeUpdate();
out.println("<HTML><HEAD><BODY>Successfully Created</BODY></HEAD></HTML>");
//}
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}