jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes How to ensure a read-only table will never be locked? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to ensure a read-only table will never be locked?" Watch "How to ensure a read-only table will never be locked?" New topic
Author

How to ensure a read-only table will never be locked?

Rob Chung
Ranch Hand

Joined: Oct 15, 2002
Posts: 46
Hi,
I have a static table that should be read only. In order for this table never to be locked, I coded:
myConnection.prepareStatement(thePreparedSQLStmt, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
Is this the correct way to prevent the table ever be locked?
Thanks in advance.
Napa Sreedhar
Ranch Hand

Joined: Jan 29, 2002
Posts: 62
Where do you want your table to read only? Database level or application level?
Rob Chung
Ranch Hand

Joined: Oct 15, 2002
Posts: 46
It would be useful to know both - at database level and application level.
I noticed that you can do setReadOnly with a connection. But I am using the same connection to write to other tables.
I am using Microsoft SQL server. I can't find any property in the database in which I can make the table read-only.
Thanks!
Praveen Balaji
Ranch Hand

Joined: Jun 17, 2001
Posts: 60
Is it SQL Server 2000 or SQLServer 7.0? The database can be made read-only manually.
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
do not give update/insert/delete access for that table to IDs used to access the datebase
obviously it would be best to seperate the read only tables into a seperate tablespace from the tables which are being updated.
Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to ensure a read-only table will never be locked?