Systems Architecture
Systems Architecture
7th Edition
ISBN: 9781305080195
Author: Stephen D. Burd
Publisher: Cengage Learning
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Any comments i could add to this?

package attendance;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;


public class SqliteDB {

Connection conn = null;
Statement stmt = null;


public SqliteDB() throws ClassNotFoundException {
//try to connect with db
try {
Class.forName("org.sqlite.JDBC");

// db parameters
String url = "jdbc:sqlite:C:/sqlite/db/attendance.db";
// create a connection to the database
conn = DriverManager.getConnection(url);

System.out.println("Connection to SQLite has been established.");

} catch (SQLException e) {
System.out.println(e.getMessage());
}
}


public void executeQuery(String query) {
try {
this.stmt = conn.createStatement();
stmt.execute(query);
}catch (Exception e) {
System.out.println(e);
}
}

public void closeConnection() {
try {
this.conn.close();
}catch( Exception e) {
System.out.println(e);
}
}


}

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning