Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

sql - java + sqlite: how to open database as read-only?

I have a large database that I want to open in read-only mode... I'm using SQLiteJDBC and am not sure what to use to get it to work as read-only.

Can anyone help?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Test demonstrate how to set connection to be read-only:

SQLiteConfig config = new SQLiteConfig();

config.setReadOnly(true); 

Connection conn = DriverManager.getConnection("jdbc:sqlite:sample.db",
config.toProperties());

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...