I want to use sqlite driver for my java application that I am developing with netbeans. What would be the correct "design" when it comes to integrating DB querys? Basically should I create a static variable holding the connection which I can use to execute sql statements through out the app? Or should I create the connection everytime I want to do the query? Here is m code
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:Mydb.db");
st = conn.createStatement();
rs = st.executeQuery(/*My sql statement*/);
Thank you
Aucun commentaire:
Enregistrer un commentaire