TurboDB

Database Connections

Previous  Top  Next

As described in "Single-File Databases and Database Directories", TurboDB supports two types of databases. The more traditional one, where each table and index has its own file on the hard disk and one, where all data is contained in one single file. In order to connect to a database, you have to set the DataSource property of the TurboDBConnection to either the database directory or to the database file. E.g:

// This opens a directory database
TurboDBConnection connection = new TurboDBConnection("c:\mydatabasedirectory\");
connection.Open();
// Now you can access database tables in *.dat files in this directory

 

// This opens a database file
TurboDBConnection connection = new TurboDBConnection("c:\mydatabases\database1.tdbd");
connection.Open();
// Now you can access database tables within the database file

In order to create a database file, you can use the method CreateDatabase of TurboDBConnection.

A TurboDB database connection can be opened read-only and/or exclusive. If you open the database connection in read-only mode, UPDATE, INSERT and DELETE commands will fail. If you open the database connection in exclusive mode, other applications and other threads will not be able to open the same database.

If you want to open a database connection for a database, which is located on a read-only medium (e.g. on a CD) then you must set the ReadOnly and the Exclusive properties to true.

See also

Single-File Databases and Database Directories