public String validateUser(String inputUserid String inputPwd) throws SQLException{ String returnString = null; String dbUserid = userid; // Your Database user id String dbPassword = password ; // Your Database password ClassforName(sunjdbcodbcJdbcOdbcDriver); Connection con = DriverManagergetConnection(jdbc:odbc:myDriver dbUserid dbPassword ); Statement stmt = concreateStatement(); String sql= select USERID from USERTABLE where USERID = + inputUserid + and PASSWORD = + inputPwd + ; ; ResultSet rs = stmtexecuteQuery(sql); if (rsnext()) { returnString = rsgetString(USERID); } stmtclose(); conclose(); return returnString ; |