Note: Database table names that contain the characters $# -+/%()&|;? are not supported.
"Connect Dialog" to display the ODBC connection dialog box
"DSN=" and then the data source name and any other information needed to connect to the data source.
"DSN=dBASE Files;DBQ=C:/Program Files/SAS/JMP/<version number>/Samples/Import Data;"
1.
An SQL statement to execute. For example, the second argument might be a SELECT statement in a quoted string like the following:
2.
The name of a data table. In this case, the effect is an SQL "SELECT * FROM" statement for the data table indicated. For example, Open Database would in effect execute the statement "SELECT * FROM BIGCLASS" if you specify this for the second argument:
3.
"SQLFILE=" and a path to a text file containing an SQL statement to be executed. For example, with the following argument, JMP would attempt to open the file mySQLFile.txt from the C:\ directory and then execute the SQL statement in the file.
The optional Invisible argument creates a hidden data table. Hidden data tables remain in memory until they are explicitly closed, reducing the amount of memory that is available to JMP. To close the hidden data table, call Close(dt), where dt is the data table reference.
The optional outputTableName argument is optional and specifies the name of the output table to be created, if any. Note that Open Database does not always return a data table. The return value might be null. Whether it returns a data table depends on the type of SQL statement executed. For example, a SELECT statement would return a data table, but a DROP TABLE statement would not.
dt << Save Database("connectInfo", "TableName");
The first argument works the same way as it does in Open Database. Note that some databases do not allow you to save a table over one that already exists. If you want to replace a table in a database, use a DROP TABLE SQL statement in an Open Database command:
Open Database ("connectinfo", "DROP TABLE TableName");
Note: When you import data from an ODBC database, a table variable is added that can contain user ID and password information. To prevent this from happening, set the following preference: pref(ODBC Hide Connection String(1)); or go to File > Preferences > Tables and select the ODBC Hide Connection String option.See Using JMP for details.
Using these three functions, you can open a connection, call Execute SQL several times, and then close the connection. Create Database Connection returns a handle for use in Execute SQL and Close Database Connection.
"DSN=dBASE Files;DBQ=C:/Program Files/SAS/JMP/<version number>/Samples/Import Data/;"