|
|
Contents | Previous | Next | sqlconnect |
| Syntax |
sqlconnect(connection string)connection string, timeout) |
| See Also | sqlexec , sqldisconnect |
The sqlconnect function uses a 'DSN-less' connection to establish a connection with an ODBC driver.
That is all information to establish a connection is provided in the connection string argument
and a DSN for the desired datasource does not need to be established. The Data Access Toolbox
supports connections to any data source for which an ODBC compliant driver has been installed. Select
the Drivers tab in the Data Sources tool available from the Control Panel
of your system to review the drivers available on your system.
The sqlconnect function must be called before using any other functions in the Data Access Toolbox.
All of the functions in the Data Access Toolbox operate on the connection that was established by the
most recent call to sqlconnect. If a data source connection has already been established
when sqlconnect is called, the previous connection is dropped, (disconnected).
Examples
sqlconnect("driver={Microsoft Access Driver (*.mdb)};Dbq=c:\omwin\omsql\Contacts.mdb;UID=;PWD=")
O-Matrix will create a connection to sample Contacts.mdb provided with the Data Access Toolbox.
(If you installed to a directory other than the default you will need to edit the value of Dbq in the above
connection string.)
sqlconnect("driver={Microsoft Access Driver (*.mdb)};Dbq=\\Harmonic\temp\Contacts.mdb;UID=;PWD=")
O-Matrix will connect to the Contacts.mdb database located in the temp directory on the server Harmonic.
sqlconnect("driver={SQL Server};server=(local)\NetSDK;Integrated Security=SSPI;database=northwind")
O-Matrix will create a connection to the Northwind database running on SQL Server with the local NetSDK server.
If you are running SQL Server you may have to edit this string to reflect the name of your server.
sqlconnect("driver={Microsoft ODBC for Oracle};server=OracleServer.world;UID=myUsername;PWD=myPassword")
sqlconnect("driver={MySQL ODBC 3.51 Driver};server=bplaptop;database=test;user=beau;")
O-Matrix will connect to the test database on the MySQL server on bplaptop.
sqlconnect("driver={MySQL ODBC 3.51 Driver};")
The MySQL ODBC driver will display a dialog prompting for connection information.