Here you can find the source of getConnection(String dbFile)
public static Connection getConnection(String dbFile) throws SQLException, URISyntaxException
//package com.java2s; /******************************************************************************* * SQLPatcher - <a//w ww .java 2 s . c o m * href="https://github.com/kbss/SQLPatcher">https://github.com/kbss * /SQLPatcher</a><br> * * Copyright (C) 2013 Serhii Krivtsov<br> * * SQLPatcher is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version.<br> * <br> * SQLPatcher is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. <br> * * @author Serhii Krivtsov ******************************************************************************/ import java.io.File; import java.net.URISyntaxException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class Main { public static Connection getConnection(String dbFile) throws SQLException, URISyntaxException { try { Class.forName("org.sqlite.JDBC"); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } Properties connectionProps = new Properties(); connectionProps.setProperty("flags", "READONLY"); Connection connection = DriverManager.getConnection("jdbc:sqlite:" + new File(dbFile).toURI().getPath(), connectionProps); return connection; } }