SQLIO Example Configurations
9.8
The following step by step instructions explain how to get SQLIO operational. Four configurations are explained based on the type of database in use.
Note:
For performance reasons, it is recommended that the schema tables be stored in SQLite database local to the runtime.
The illustations below are done in the simplest manner possible with the fewest changes required to programs.
The PL/B language has an extensive set of options available to alter SQLIO operations during program execution. These options may be specified in the PLBWIN.INI file, by using SETMODE, or in the actual OPEN/PREP statements.
You should allow the PREP instruction to create the tables for any files defined. This will ensure that they are created with the necessary attributes as required by SQLIO.
The SchemaEditor must be restarted after any modifications are made to the PLBWIN.INI file.
Once configured, the syntax for preparing or opening a file is:
Example Configuration #1
The schema and data will be in one SQLite database (\sunbelt\plbwin.??\code\sunschema.db)
Note:
There should be no PLB_SQLIO keywords in the plbwin.ini configuration file
It is assumed that the schema database does not currently exist.
No modifications to the PLBWIN.INI file are required.
Procedure:
Start the Schema Editor.
Select "File/New" and create "sunschema.db" in the "\sunbelt\plbwin.??\code" directory.
Select the "SQLIO" tab.
Select "SQL Files/Add" from the menu.
Create a new file definition specifying a file name (i.e, address.txt) and a table name (i.e., address) with at least one column (i.e., "name" with a length of 20).
Edit the "address.txt" file definition once again.
Click the "Test Prep" button to verify the configuation.
You can use a utility such as DBExplorer to verify the creation of the table.
Example Configuration #2
The schema and user data will be in seperate SQLite databases
Note:
The SQLite schema will be in "\sunbelt\plbwin.??\code\sunschema.db". No sunschema database currently exists.
The user database will be "\temp\test.db".
One modification to the PLBWIN.INI file is required.
Procedure:
Add the following line to the "Environment" section of the PLBWIN.INI file in the \sunbelt\plbwin.??\code directory:
Start the Schema Editor.
Select "File/New" and create "sunschema.db" in the "\sunbelt\plbwin.??\code" directory.
Select the "SQLIO" tab.
Select "Databases/Add" from the menu.
Enter "testdb" (the same name as used in step 1) for the name and "\temp\test.db" for the database file.
Respond "Yes" to the prompt regarding the creation of the database.
Close the database editor window.
Select "SQL Files/Add" from the menu.
Create a new file definition specifying a file name (i.e, address.txt) and and a table name (i.e., address) with at least one column (i.e., "name" with a length of 20).
Edit the "address.txt" file definition once again.
Click the "Test Prep" button to verify the configuation.
You can use a utility such as DBExplorer to verify the creation of the table.
Example Configuration #3
An SQLite schema with user tables stored in a SQL Server database
Note:
1. The schema will be in "\sunbelt\plbwin.??\code\sunschema.db". No sunschema database currently exists.
2. The user database has been created using the Microsoft SQL Server Management Studio and is empty.
3. Three modifications to the PLBWIN.INI file are required.
4. The Sql Server ODBC driver must be installed.
Procedure:
Begin by configuring the ODBC connection:
From the Windows Control Panel/Administrative Tools/Data Sources (ODBC), select the "System DSN" tab.
Click "Add" and select "SQL Server" driver.
Enter a name (i.e., SQLIO) and select the server from the drop-down list.
Click "Next" and configure the login as required by the database server.
Select the "Change the default database" checkbox and select the user database name from the drop-down list.
Click "Next", "Finish" and finally "Test Data Source".
Do not proceed until the test is successful.
Finally click "OK" and exit the Control Panel.
Next, set up the runtime and schema:
Add the following lines to the "Environment" section of the PLBWIN.INI file in the \sunbelt\plbwin.??\code directory:
Start the Schema Editor.
Select "File/New" and create "sunschema.db" in the "\sunbelt\plbwin.??\code" directory.
Select the "SQLIO" tab.
Select "Data Sources/Add" from the menu.
Enter "testdb" (the same name as used in step 1 for the PLB_SQLTABLEDB keyword) for the name and "\temp\test.db" for the database file.
Select "DBFILE" for the driver and "MS-SQL" for the SQL Language.
Enter "DBADO;;DSN=SQLIO;UID={user id};PWD={user password};DATABASE={user database}" for the "Host" parameter.
Replace the "{user id}", "{user password}", and "{user database} entries in the parameter with values used during the ODBC configuration.
Click "Test Connection" to ensure the configuration is correct. Do not continue until the test is successful.
Close the database editor window by clicking "Update".
Select "SQL Files/Add" from the menu.
Create a new file definition specifying a file name (i.e, address.txt) and and a table name (i.e., address) with at least one column (i.e., "name" with a length of 20).
Edit the "address.txt" file definition once again.
Click the "Test Prep" button to verify the configuation.
You can use a database administration utility to verify the creation of the table.
Example Configuration #4
An SQLite schema with user tables stored in a MySQL database
Note:
The schema will be in "\sunbelt\plbwin.??\code\sunschema.db". No sunschema database currently exists.
The user database has been created using phpMyAdmin or other database administrative utility and is empty.
Four modifications to the PLBWIN.INI file are required.
The MySql ODBC driver must be installed.
Procedure:
Set up the runtime and schema:
Add the following lines to the "Environment" section of the PLBWIN.INI file in the \sunbelt\plbwin.??\code directory:
Start the Schema Editor.
Select "File/New" and create "sunschema.db" in the "\sunbelt\plbwin.??\code" directory.
Select the "SQLIO" tab.
Select "Data Sources/Add" from the menu.
Enter "testdb" (the same name as used in step 1 for the PLB_SQLTABLEDB keyword) for the name and "\temp\test.db" for the database file.
Select "DBFILE" for the driver and "MYSQL" for the SQL Language.
Enter "MYSQL;;{host}" for the Host parameter. "{host}" may be an IP address or a host name. Enter the user name and password for the MYSQL database. In the "Connect" field, enter the database name.
Click "Test Connection" to ensure the configuration is correct. Do not continue until the test is successful.
Close the database editor window by clicking "Update".
Select "SQL Files/Add" from the menu.
Create a new file definition specifying a file name (i.e, address.txt) and and a table name (i.e., address) with at least one column (i.e., "name" with a length of 20).
Edit the "address.txt" file definition once again.
Click the "Test Prep" button to verify the configuation.
You can use a database administration utility to verify the creation of the table.
See Also: SQLIO Overview, SQLIO Runtime Keywords
![]() |