Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- public class Jdbc {
- static java.sql.Connection connection = null;
- static java.sql.Statement statement = null;
- static boolean checkUser(String user, String password) {
- try {
- connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/login", "root", "");
- statement = connection.createStatement();
- String select = "select * from login where user" + user + "password" + password;
- System.out.println("The SQL is :" + select);
- ResultSet rset = statement.executeQuery(select);
- user = rset.getString("user");
- password = rset.getString("password");
- rset.next();
- }
- catch (SQLException ex) {
- ex.printStackTrace();
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement