org.sqlite.SQLiteDataSource Java Examples
The following examples show how to use
org.sqlite.SQLiteDataSource.
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: DataSourceConfiguration.java From md_blockchain with Apache License 2.0 | 5 votes |
@Bean(destroyMethod = "", name = "EmbeddeddataSource") public DataSource dataSource() { DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); dataSourceBuilder.driverClassName("org.sqlite.JDBC"); dataSourceBuilder.url("jdbc:sqlite:" + dbName); dataSourceBuilder.type(SQLiteDataSource.class); return dataSourceBuilder.build(); }
Example #2
Source File: SqliteDbJobStore.java From sylph with Apache License 2.0 | 5 votes |
@Autowired public SqliteDbJobStore( ServerMainConfig config, JobEngineManager runnerManger ) { this.config = requireNonNull(config, "server config is null"); this.runnerManger = requireNonNull(runnerManger, "runnerManger config is null"); SQLiteDataSource dataSource = new SQLiteDataSource(); dataSource.setUrl("jdbc:sqlite:data/data.db"); this.queryRunner = new QueryRunner(dataSource); this.dataSource = dataSource; }
Example #3
Source File: ScoreDatabaseAccessor.java From beatoraja with GNU General Public License v3.0 | 5 votes |
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 |
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 |
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 |
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: OffHeapPersistence.java From cqengine with Apache License 2.0 | 5 votes |
protected OffHeapPersistence(SimpleAttribute<O, A> primaryKeyAttribute, Properties overrideProperties) { Properties effectiveProperties = new Properties(DEFAULT_PROPERTIES); effectiveProperties.putAll(overrideProperties); SQLiteConfig sqLiteConfig = new SQLiteConfig(effectiveProperties); SQLiteDataSource sqLiteDataSource = new SQLiteDataSource(sqLiteConfig); String instanceName = "cqengine_" + INSTANCE_ID_GENERATOR.incrementAndGet(); sqLiteDataSource.setUrl("jdbc:sqlite:file:" + instanceName + "?mode=memory&cache=shared"); this.primaryKeyAttribute = primaryKeyAttribute; this.instanceName = instanceName; this.sqLiteDataSource = sqLiteDataSource; this.persistentConnection = getConnectionInternal(null, noQueryOptions()); }
Example #8
Source File: DiskPersistence.java From cqengine with Apache License 2.0 | 5 votes |
protected DiskPersistence(SimpleAttribute<O, A> primaryKeyAttribute, File file, Properties overrideProperties) { Properties effectiveProperties = new Properties(); effectiveProperties.putAll(DEFAULT_PROPERTIES); effectiveProperties.putAll(overrideProperties); SQLiteConfig sqLiteConfig = new SQLiteConfig(effectiveProperties); SQLiteDataSource sqLiteDataSource = new SQLiteDataSource(sqLiteConfig); sqLiteDataSource.setUrl("jdbc:sqlite:file:" + file); this.primaryKeyAttribute = primaryKeyAttribute; this.file = file.getAbsoluteFile(); this.sqLiteDataSource = sqLiteDataSource; boolean openPersistentConnection = "true".equals(effectiveProperties.getProperty("persistent_connection")); //default false boolean useSharedCache = "true".equals(effectiveProperties.getProperty("shared_cache")); // default false boolean useReadWriteLock = !"false".equals(effectiveProperties.getProperty("use_read_write_lock")); // default true if (useSharedCache) { // If shared_cache mode is enabled, by default we also use a read-write lock, // unless using the read-write lock has been explicitly disabled... sqLiteDataSource.setUrl("jdbc:sqlite:file:" + file + "?cache=shared"); this.useReadWriteLock = useReadWriteLock; } else { // If we are not using shared_cache mode, we never use a read-write lock... sqLiteDataSource.setUrl("jdbc:sqlite:file:" + file); this.useReadWriteLock = false; } if (useSharedCache || openPersistentConnection) { // If shared_cache is enabled, we always open a persistent connection regardless... this.persistentConnection = getConnectionWithoutRWLock(null, noQueryOptions()); } }
Example #9
Source File: OffHeapPersistenceTest.java From cqengine with Apache License 2.0 | 5 votes |
@Test public void testEqualsAndHashCode() { SQLiteDataSource ds1 = new SQLiteDataSource(new SQLiteConfig()); ds1.setUrl("foo"); SQLiteDataSource ds2 = new SQLiteDataSource(new SQLiteConfig()); ds2.setUrl("bar"); EqualsVerifier.forClass(OffHeapPersistence.class) .withIgnoredFields("sqLiteDataSource", "persistentConnection", "closed", "readWriteLock") .suppress(Warning.NULL_FIELDS, Warning.STRICT_INHERITANCE) .withPrefabValues(SQLiteDataSource.class, ds1, ds2) .verify(); }
Example #10
Source File: DiskPersistenceTest.java From cqengine with Apache License 2.0 | 5 votes |
@Test public void testEqualsAndHashCode() { SQLiteDataSource ds1 = new SQLiteDataSource(new SQLiteConfig()); ds1.setUrl("foo"); SQLiteDataSource ds2 = new SQLiteDataSource(new SQLiteConfig()); ds2.setUrl("bar"); EqualsVerifier.forClass(DiskPersistence.class) .withIgnoredFields("sqLiteDataSource", "persistentConnection", "closed", "useReadWriteLock", "readWriteLock") .suppress(Warning.NULL_FIELDS, Warning.STRICT_INHERITANCE) .withPrefabValues(SQLiteDataSource.class, ds1, ds2) .verify(); }
Example #11
Source File: TemporaryDatabase.java From cqengine with Apache License 2.0 | 5 votes |
@Override public void before() { try { super.before(); dbFile = newFile(); url = "jdbc:sqlite:" + dbFile.getAbsolutePath(); dataSource = new SQLiteDataSource(config); dataSource.setUrl(url); } catch (Throwable throwable) { throw new IllegalStateException(throwable); } }
Example #12
Source File: AbstractSQLiteSyncTarget.java From domino-jna with Apache License 2.0 | 4 votes |
@Override protected DataSource createDataSource(String jdbcUrl) { SQLiteDataSource ds = new SQLiteDataSource(); ds.setUrl(jdbcUrl); return ds; }
Example #13
Source File: SqliteDataSourceProvider.java From hadoop-ozone with Apache License 2.0 | 3 votes |
/** * Create a pooled datasource for the application. * <p> * Default sqlite database does not work with a connection pool, actually * most embedded databases do not, hence returning native implementation for * default db. */ @Override public DataSource get() { SQLiteDataSource ds = new SQLiteDataSource(); ds.setUrl(configuration.getJdbcUrl()); return ds; }