Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...