Eclipse project

1 answer below »
Answered 9 days AfterAug 01, 2021

Answer To: Eclipse project

Breeze Prakash answered on Aug 03 2021
151 Votes
import java.sql.*;
public class DBQuery {
private String connectionURL = "jdbc:postgresql://localhost:54
32/";
private Connection connection = null;
private PreparedStatement statement = null;
private ResultSet rs = null;
private String query = "select * from users where login=?";
private String insert = "insert into users(login, firstname, lastname, password) values (?,?,?,?)";
public DBQuery() {
// TODO Auto-generated constructor stub
// get a DB connection
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "postgres", "12345");
}
catch(Exception e){
e.printStackTrace();
}
}
@Override
protected void finalize() {
try{
connection.close();
}
catch(SQLException e){
e.printStackTrace();
}
}
public boolean validate(String login, String password){
boolean result = false;
try{
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here