A list of products available on this site
Documentation for XtraMania's xtras
Prices and links to the online store
Xtras, PDFs, samples
Have a question? Ask us!
Contacts
Logo. www.xtramaina.com  
Home Search E-mail
ADOxtra FAQs/ADOxtra & CDROM

ADOxtra for Macromedia Director

Can ADOxtra open Access database from CD-ROM?

Yes, ADO (and ADOxtra) can use Access databases stored on read only media (network shares or CD-ROMs).

Be sure to use correct connection string to open a database from read only media. The problem may arise due to a way how Jet provider stores information about database locking. Usually it creates a file near the database itself. So if requested sharing mode requires such file, ADO will try to create it and will fail to create a file on the CD-ROM or other read-only media.

For example, if NT folder permissions for D:\Temp\ are set to read only and
if you use following connection string:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\Temp\TestDB.mdb; Mode=Read"
It fails with a error saying that it cannot create locking file. For sure it
cannot do it on CD-ROM. Using Mode=Read usually opens database in shared mode for reading data. It will not work on CD-ROM.

If you use connection string without any Mode property settings:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\Temp\TestDB.mdb"
connection opens successfully even from read only media. If you check then the default settings of a mode property for an opened connection:
put cnn.Mode
it tells you that it is 13=1+12 (Read and Share Exclusive)

So if you use:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\Temp\TestDB.mdb; Mode=Read|Share Exclusive"
it opens successfully again.

So, to open database from read only media, you may skip Mode property in the connection string. It should open correctly by default. Note: the default behavior might change from ADO version to version. So it is usually better to explicitly specify the access mode.

Site homeSearchContact author © Eugene Shoustrov. www.xtramania.com