All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lab.helloworld.MySQLiteUtils Maven / Gradle / Ivy

There is a newer version: 2.2.3
Show newest version
package com.lab.helloworld;

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

/**
 *
 * @author youyinnn
 *
 */
public class MySQLiteUtils {

    public static Connection getConn(String databaseName){
        Connection connection = null;
        try {
            connection = DriverManager.getConnection("jdbc:sqlite:"+databaseName);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return connection;
    }

    public static Connection getConn(String databaseName, boolean autoCommit) {
        Connection connection = null;

        try {
            connection = DriverManager.getConnection("jdbc:sqlite:"+databaseName);
            connection.setAutoCommit(autoCommit);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return connection;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy