Skip to content

Instantly share code, notes, and snippets.

@jonatasemidio
Created September 8, 2017 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonatasemidio/2eeeadf8e4cc2c7768830db94f99b6c6 to your computer and use it in GitHub Desktop.
Save jonatasemidio/2eeeadf8e4cc2c7768830db94f99b6c6 to your computer and use it in GitHub Desktop.
ConnectionFactory using sqlite driver
package com.tecgraf.plugins.server.dao.conf;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory {
public static Connection getConnection() {
try {
Class.forName ("org.sqlite.JDBC");
Connection connection = DriverManager.getConnection("jdbc:sqlite:plugins.db");
return connection;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment