Skip to content

TSTool / Command / NewAccessDatabase


Overview

The NewAccessDatabase command creates a new, empty, Microsoft Access database. Access databases are single file databases that are useful for creating, manipulating, and publishing datasets. TSTool tables can be read from a database using ReadTableFromDataStore command and written to a database using WriteTableToDataStore command. The RunSql command can be used to perform other operations. The following are technical considerations:

  • the datastore is dynamically created as a GenericDatabase using a JDBC connection
  • database names should have .accdb extension for versions 2007 and later, and .mdb for older versions
  • if appropriate for a workflow, use the RemoveFile or CopyFile commands to handle an existing database file before creating a new database with the same name
  • for databases that are dynamically created, a database file that is in use cannot be overwritten
  • use a CloseDataStore command to close a previously created (and opened) datastore, for example if rerunning a command file

A file database may perform slowly on database inserts due to the need to write to disk and the relatively slow speed of disk seek and write (compared to in-memory operations). It is generally much faster to read data than write data.

Command Editor

The following dialog is used to edit the command and illustrates the command syntax.

NewAccessDatabase

NewAccessDatabase Command Editor (see also the full-size image)

Command Syntax

The command syntax is as follows:

NewAccessDatabase(Parameter="Value",...)

Command Parameters

Parameter             Description Default          
DataStore
required
DataStore name for the database that will be created. Can be specified using processor ${Property}. None – must be specified.
DatabaseFile The name of the database file as full path or path relative to the command file. A file extension of .accdb should be used, or .mdb for Access versions 2000 and 2003. Rerunning a command file will recreate the database. Use a datastore configuration file rather than this command if the database should be available throughout multiple TSTool sessions. None - must be specified.
Version The Access version for the file, one of: 2000, 2003, 2007, 2010, 2016. 2016

Examples

See the automated tests.

Troubleshooting

See Also