Databases Settings (Magic xpa 3.x)
The Database repository registers details about all the physical databases and XML data sources that can be accessed in the current installation of Magic xpa.
The first step in defining a data source is to define the database in which the data source is located.
You can access the Database repository by selecting Databases from the Settings menu.
The Database repository includes the following columns:
|
|
#
|
The database identifier (#) used in the project. Magic xpa sets this column automatically.
|
Name
|
The Name column is a short description of the physical database. The Name value is used as a label (string) that identifies the database anywhere in Magic xpa where such reference is required, for example, in the Data repository. By using a label, instead of an index in the Database repository, Magic xpa makes the application more portable, because it is unlikely that different developers will use the same label. The Name value is case-sensitive.
|
Data Source Type
|
Identifies the type of the underlying data source.
When creating a new line, some of the properties are inherited from the DBMS repository.
In the Data Source Type column you can select one of the following values:
DBMS – For databases.
XML File – For XML data sources. When you select this option, the Database Name and DBMS columns are disabled. When you select this option, in the Location column, you can set a file system path (with or without the prefix – file://) or a URL (HTTP/HTTPS) to the location of the XML files. Magic xpa will use this location to prefix the data source names in the Data repository, when the data source name has no path.
An XML database can be selected in the Default Database environment setting.
An XML database cannot be selected in the Database for Sort/Temporary environment setting.
|
Database Name
|
Identifies the database that you want to connect to in the RDBMS. RDBMSs can support and handle more than one database. This property is optional. Some of the DBMSs that Magic xpa supports maintain several separate sub-databases in the same RDBMS.
The Database Name is the name of the sub-database as defined by the RDBMS.
Note:
|
If the database name contains a special character, such as a space or a hyphen (-), begins with a number, or ends with a plus sign (+), you must surround the database name with square brackets, such as [305n] or [table-name].
|
Platform specific:
-
In ODBC databases, the Database Name is the name of the defined Data Source in the ODBC administrator.
-
For SQLite databases, leave this column blank, since there is no database name in SQLite.
-
For GigaSpaces databases, the Database Name is the space name, such as Embedded_DB.
|
DBMS
|
Identifies the name and type of the underlying database. This column can be modified only by selecting a value from the DBMS list (zoom to the list). When creating a new line, some of the properties are inherited from the DBMS repository (properties that appear in the DBMS repository).
See also: Databases
|
Location
|
The physical location where the files associated with the database are located.
The Location column is relevant for ISAM databases, SQLite databases, Local databases or XML files. It is not valid for other SQL databases.
For ISAM databases and XML files, this column is optional. If this column is empty, the files will be saved in Magic xpa's root directory.
For SQLite and Local databases, this column is mandatory and defines the SQLite database location and filename. If only a filename is specified, it will be stored in the projects folder.
Note:
|
For Local databases used on mobile devices, it is recommended not to define a path.
|
A Logical Name can be used for this column.
Platform specific: If you are using a DB2/400 database, use the Library Name.
|
By default, a number of entries are created automatically in the Database repository, including:
-
Memory – This database can be used by the developer or by Magic xpa for internal uses when memory tables are needed. Note: The memory database does not support transactions, because there is no database behind the scenes. The memory gateway should only be used when the application "knows" that the data entered is intact.
-
Default XML database – This database serves as a default database when you define a new XML data source.
-
Default XML Memory database – This database is used as the default temporary storage for the Default XML database (defined in the XML Database properties).
Magic xpa allows you to connect to multiple database management systems (DBMSs) such as Btrieve, MicrosoftSQL, and Oracle. Some of these DBMSs provide support for the distribution of data on different physical locations on one machine, or even across several different machines. Some of the DBMSs that Magic xpa supports maintain several separate physical databases within the framework of one logical entity. Using the Database repository, Magic xpa can gain access to these different physical databases.
You can supply additional information about the database or data source using the Database Properties dialog box.
You access the Database Properties dialog box by right-clicking and selecting Properties from the Database repository, or by pressing Alt+Enter.
Database repository information is contained in the [MAGIC_DATABASES] section of the Magic.ini file.
In the Database repository, you can define multiple Magic xpa database entries to point to the same SQL database.
For example:
If a set of tables in the database are accessed by one user and another set of tables are accessed by a second user, then two identical definitions can be defined for each user name.
Note:
|
Once the connection to a database is created, it is only disconnected explicitly (using the Magic xpa DbDiscnt function or by the DBA) or by exiting Magic xpa (exiting the application will not close the connection). The changes made in the Database properties will take effect only in the next connection to the database.
It is recommended to exit Magic xpa and launch it again whenever you change a database property that affects the behavior of a Magic xpa gateway.
|
Databases chapter in the Mastering Magic xpa guide