I am trying to build a CRUD to interact with an SQLite database. This is the code I use to successfully connect with the database:
package DbConnector;
import java.sql.*;
import javax.swing.*;
public class DBConnect {
public static void main (String[] args) {
Connection conn = null;
try{
Class.forName("org.sqlite.JDBC");
conn =DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Kieran\\Documents\\NetBeansProjects\\Rebeldb.s3db");
}catch (Exception e) {
}
//* This is where you put the code that main will actually execute, after having connected to the database
System.out.println("Opened database successfully");
}
}
Since I connected to the database successfully, I want to be able to perform basic functions with it based off of user input. I wanted to build methods for this CRUD. I tried following this example: Single DAO & generic CRUD methods (JPA/Hibernate + Spring)
But I can't figure out what's going on with all the T's.
What I'm hoping to be able to do is have a method that can be linked to a button. All I can do so far is add hardcode to my connection, which isn't re-usable
Thanks for reading - any help you can give is greatly appreciated, I can demonstrate more effort (failed attempts) or explain in more detail if that's needed.
Aucun commentaire:
Enregistrer un commentaire