简体   繁体   中英

Creating Database in JDBC Sqlite

I am using the SQLite driver from http://code.google.com/p/sqlite-jdbc/wiki/Introduction Examples shown in the above doc shows how to connect an existing database.

In my application I need to create an SQLite database. How to do that? Is it sufficient to create a file with extension .db ? Also is there a function called createFile() . If so how to use it? I googled and nobody is giving a clear answer.

SQLite creates new database file on first attempt to connect if file did not exist already.

So, simply use jdbc:sqlite:filename.db as JDBC connection string, and provided that you have permission to create filename.db , it will be created automatically. You can also manually pre-create this file with 0 size if you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM