/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ai_assignment;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author ADAM KENYON
*/
public class AI_Assignment {
String connectString = "D:\Users\ADAM KENYON\Documents\NetBeansProjects\AI_Assignment\Database\AI_assignment";
private static Object ex;
/**
* @param args the command line arguments
* @throws java.text.ParseException
*/
public static void main(String[] args) throws ParseException {
// TODO code application logic here
AI_Assignment assignment = new AI_Assignment(); assignment.database();
}
public void database() throws ParseException {
try {
Connection con;
Class.forName("org.hsqldb.jdbcDriver");
con = DriverManager.getConnection("jdbc:hsqldb:file:" + connectString, // filenames
"", // username
""); // password
try (Statement statement = con.createStatement()) {
ResultSet rs = statement.executeQuery("SELECT * FROM TEST");
while (rs.next()) {
int ID = rs.getInt("ID");
System.out.print(ID);
}
statement.close();
con.close();
}
} catch (SQLException | ClassNotFoundException SQLException) {
Logger.getLogger(AI_Assignment.class.getName()).log(Level.SEVERE, null, SQLException);
}
}
}
/*
* To change this license header, choose Lic