Get cell value from mysql by JDBC
My method should get username and password from my adminTable:
My table in MySql console:
My method:
public void adminEnterCondition(){
Connection con;
PreparedStatement preparedStatement;
ResultSet resultSet;
String query = "select * from admintable";
String username,password;
try {
con= DriverManager.getConnection(...);
preparedStatement = con.prepareStatement(query);
resultSet = preparedStatement.executeQuery();
username = ...
password = ...
}
catch (SQLException sqle){
sqle.printStackTrace();
}
}
No comments:
Post a Comment