Java Code Examples for org.sqlite.SQLiteConfig#setSynchronous()

The following examples show how to use org.sqlite.SQLiteConfig#setSynchronous() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TMDatabaseImpl.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void start() throws SQLException, ClassNotFoundException {
	File file = new File(metaData.getDataPath()+File.separator+metaData.getDatabaseName());
	if(!file.exists()){
		throw new SQLException("File not found");
	}
	
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSynchronous(SynchronousMode.OFF);

	String url = Utils.replaceParams(dbConfig.getDbURL(), metaData);

	url = url.replace("__FILE_SEPARATOR__", File.separator);
	String driver = dbConfig.getDriver();
	Class.forName(driver);
	Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData);
	SQLiteConfig config = new SQLiteConfig(prop);
	config.setSynchronous(SynchronousMode.OFF);
	conn = DriverManager.getConnection(url, config.toProperties());
	// conn.setAutoCommit(false);
}
 
Example 2
Source File: ModifyAccessionMappingDatabase.java    From megan-ce with GNU General Public License v3.0 5 votes vote down vote up
/**
 * constructor
 *
 * @param databaseFile
 */
public ModifyAccessionMappingDatabase(String databaseFile) throws IOException, SQLException {
    this.databaseFile = databaseFile;

    System.err.println("Database '" + databaseFile + "', current contents: ");
    try (AccessAccessionMappingDatabase accessAccessionMappingDatabase = new AccessAccessionMappingDatabase(databaseFile)) {
        System.err.println(accessAccessionMappingDatabase.getInfo());
    }

    config = new SQLiteConfig();
    config.setCacheSize(10000);
    config.setLockingMode(SQLiteConfig.LockingMode.EXCLUSIVE);
    config.setSynchronous(SQLiteConfig.SynchronousMode.NORMAL);
    config.setJournalMode(SQLiteConfig.JournalMode.WAL);
}
 
Example 3
Source File: ScoreDatabaseAccessor.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public ScoreDatabaseAccessor(String path) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	SQLiteDataSource ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + path);
	qr = new QueryRunner(ds);
}
 
Example 4
Source File: SongInformationAccessor.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public SongInformationAccessor(String filepath) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + filepath);
	qr = new QueryRunner(ds);
	createTable();
}
 
Example 5
Source File: SQLiteSongDatabaseAccessor.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public SQLiteSongDatabaseAccessor(String filepath, String[] bmsroot) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + filepath);
	qr = new QueryRunner(ds);
	root = Paths.get(".");
	createTable();
}
 
Example 6
Source File: ScoreLogDatabaseAccessor.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
public ScoreLogDatabaseAccessor(String path) throws ClassNotFoundException {
	Class.forName("org.sqlite.JDBC");
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSharedCache(true);
	conf.setSynchronous(SynchronousMode.OFF);
	// conf.setJournalMode(JournalMode.MEMORY);
	ds = new SQLiteDataSource(conf);
	ds.setUrl("jdbc:sqlite:" + path);
	qr = new QueryRunner(ds);
	createTable();		
}
 
Example 7
Source File: TMDatabaseImpl.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void start() throws SQLException, ClassNotFoundException {
	SQLiteConfig conf = new SQLiteConfig();
	conf.setSynchronous(SynchronousMode.OFF);

	String url = Utils.replaceParams(dbConfig.getDbURL(), metaData);
	url = url.replace("__FILE_SEPARATOR__", File.separator);
	String driver = dbConfig.getDriver();
	Class.forName(driver);
	Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData);
	SQLiteConfig config = new SQLiteConfig(prop);
	config.setSynchronous(SynchronousMode.OFF);
	conn = DriverManager.getConnection(url, config.toProperties());
	// conn.setAutoCommit(false);
}