dbpOpenDatabase

Purpose:

Open a database using a file name or server connection string. A connection string should include a provider, data source, user name, password, etc. as required by server. See Opening a Database for more information.

Category:

Database

Syntax:

dbpOpenDatabase "database id" "file name or connection string"

database id

A name that you want to use to refer to this database in the future.

file name or connection string

The type of database you're using dictates whether you can use a simple file name or connection string here. See Opening a Database for more information.

Example:

The following example opens a dBase format file called Sample.dbf:


dbpOpenDatabase "DB1" "[PubDir]Sample.dbf"


Here we use a connection string to open a MySQL database:


dbpOpenDatabase "MySQL" "Provider=MSDASQL.1;Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=test;User=root;Password=apple;Option=3"


Here is a connection string to open a SQLite database:


dbpOpenDatabase "SQLite" "Provider=MSDASQL.1;Driver=SQLite3 ODBC Driver;Database=C:\Program Files\SQLite ODBC Driver\test.db"


Note: SQLite requires that you have a compatible ODBC driver installed on your PC. If you don't have a SQLite ODBC driver, you can find one at the following web site: http://www.ch-werner.de/sqliteodbc/

SQL Equivalent:


USE database


dbpOpenAccessDatabase

Purpose:

Open a Microsoft Access (MDB or ACCDB) format database file. To open other types of databases use dbpOpenDatabase instead. See Opening a Database for more information.

Category:

Database

Syntax:

dbpOpenAccessDatabase "database id" "file name" "options"

database id

A name that you want to use to refer to this database in the future.

file name

The database file name.

options

This is a compound parameter and can contain any combination of the following items:


Password=pwd

Replace pwd with the password required to open this database. Leave this option blank if the database is not password protected.

CursorLocation=value

This defines the method used to access data. Value may be one of the following:


Client

Client-side processing. (Recommended for small and medium-sized databases.)

Server

Server-side processing. (Recommended for advanced users working with very large databases.)


By default NeoDBpro uses something called a client-side cursor. This is a method of accessing data that relies on the client application to handle most of the data storage and processing. Client-side processing is very flexible and generally provides the fastest performance for small to medium sized databases. For large databases, however, a client-side cursor can sometimes consume too many system resources resulting in poor performance. To compensate for this problem, you may want to use a server-side cursor when working with very large databases.


With a client-side cursor (the default) all data is copied to the local machine and processed there. This provides access to features not normally supported by servers such as sorting and indexing. When using a SQL query, only the data returned is copied to the local machine. A server-side cursor doesn't provide as much flexibility, but is often more appropriate for large databases, and may be required when the size of a database exceeds the available memory and disk space available on a local machine.


Separate multiple items in a compound variable with semicolons (;). This parameter may be left blank if none of the options are required.

Example:

dbpOpenAccessDatabase "DB1" "[PubDir]AddressBook.mdb" "password=kitty123"

SQL Equivalent:


N/A


dbpCreateAccessDatabase

Purpose:

Create a new Microsoft Access (MDB or ACCDB) format database file. This action only creates the database - it does not open it. You must use dbpOpenAccessDatabase to open the database for editing.

Category:

Database

Syntax:

dbpCreateAccessDatabase "file name" "options"

file name

The database file name.

options

This is a compound parameter and can contain any combination of the following items:


Password=pwd

Replace pwd with the password you wish to use to protect this database. The password assigned here must be passed to dbpOpenAccessDatabase in order to open the database in the future. Please use caution when assigning passwords. If you forget the password, you will not be able to open the database.

Encrypted=Yes/No

Use "Encrypted=Yes" to encrypt the database file to protect the data from being viewed with a hex editor.


Separate multiple items in a compound variable with semicolons (;). This parameter may be left blank if a password and encryption are not desired.

Example:

dbpCreateAccessDatabase "[PubDir]AddressBook.mdb" "Password=kitty123;Encrypted=Yes"


To create unprotected, unencrypted database you can simply leave the options parameter blank:


dbpCreateAccessDatabase "[PubDir]AddressBook.mdb" ""

SQL Equivalent:


N/A


dbpCompactAccessDatabase

Purpose:

Compress a Microsoft Access (MDB or ACCDB) format database file and remove space occupied by deleted records. When records are deleted using dbpDeleteRecord, the physical size of the database file does not necessarily decrease. Instead the database may simply mark the record as deleted, but the space occupied by the record remains in the file. dbpCompactAccessDatabase removes any records marked as deleted and reduces the size of the database file.

Category:

Database

Syntax:

dbpCompactAccessDatabase "file name" "password"

file name

The database file name.

options

This is a compound parameter and can contain any combination of the following items:


Password=pwd

Replace pwd with the password required to access the database. Leave blank if no password is required.

Encrypted=Yes/No

Use "Encrypted=Yes" to encrypt the database file while compressing  the data.


Separate multiple items in a compound variable with semicolons (;). This parameter may be left blank if a password and encryption are not required.

Example:

dbpCompactAccessDatabase "[PubDir]AddressBook.mdb" ""

SQL Equivalent:


N/A


dbpCloseDatabase

Purpose:

Close a database previously opened with dbpOpenDatabase or dbpOpenAccessDatabase. Calling dbpCloseDatabase is optional since any databases or tables that are open when a publication is shutdown will automatically be closed.

Category:

Database

Syntax:

dbpCloseDatabase "database id"

database id

The name assigned to the database you want to close.

Example:

dbpCloseDatabase "DB1"

SQL Equivalent:


N/A