尝试
//put the imports where they really go, obviously...import javax.sql.*;import org.sqlite.*;import com.mchange.v2.c3p0.*;// configure SQLiteSQLiteConfig config = new org.sqlite.SQLiteConfig();config.setReadonly(true);config.setPageSize(4096); //in bytesconfig.setCacheSize(2000); //number of pagesconfig.setSynchronous(SQLiteConfig.SynchronousMode.OFF);config.setJournalMode(SQLiteConfig.JournalMode.OFF);// get an unpooled SQLite DataSource with the desired configurationSQLiteDataSource unpooled = new SQLiteDataSource( config );// get a pooled c3p0 DataSource that wraps the unpooled SQLite DataSourceDataSource pooled = DataSources.pooledDataSource( unpooled );
pooled现在,数据源将是c3p0 PooledDataSource,它包装了已根据需要配置的SQLite未池化数据源。
请参阅C3P0的文档,“使用数据源工厂类”,并为API文档数据源工厂类。
另请参阅我从此处下载的用于SQLite
JDBC的javadocs 来回答这个问题。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)