Creates a connection between Director and your data source
Usage:
dbOpen (object me, string connectionString)
Parameter:
connectionString: (string) is left untouched from the C++ code because it allows for maximum flexibility. With the correct connection string and installed driver, you can connect to any data source, including SQL Server, Oracle, Microsoft Excel, dBASE, Microsoft Access or MySQL
Returns:
(integer) - The success code
Example:
xtRose = xtra("Rosetta").new( )
xtRose.dbOpen( "Provider=MSDASQL;ExtendedAnsiSQL=2;DRIVER={Microsoft Access Driver (*.mdb)};Dbq="&the moviepath&"main" )
Notes:
To connect to an Access database, use:
_str_connectionString = "Driver={Microsoft Access Driver (*.mdb)};Dbq="&the moviepath&"main"&";Uid=admin;Pwd="To connect to an Excel spreadsheet, use:
_str_connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""E&the moviepath&main.xls"E&";Extended Properties=""E&"Excel 8.0; HDR=NO;IMEX=1;""ETo connect to an CSV file, use:
_str_connectionString = "Provider=MSDASQL;Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq="&the moviepath&";Extensions=asc,csv,tab,txt"
To connect to an dBASE file, use:
_str_connectionString = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq="&the moviepath&";"To connect to mySQL, use:
_str_connectionString = "Driver={MySQL ODBC 3.51 Driver};Server=192.168.1.1;Database=mysql;Option=4;User=root;Password=;"To connect to SQL Server, use:
_str_connectionString = "Driver={SQL Server};Server=xxx.xxx.xxx; Address=xxx.xxx.xxx,1433; Network=DBMSSOCN; Database=DATABASENAME; Uid=USERNAME;Pwd=PASSWORD")** be sure to change the moviepath, filename or server IP to match your local settings
These are just some examples of various connection strings. A detailed list can be found at some of the links provided at http://xtras.calu.us/links.php
To test if the connection was opened successfully, use dbProperties () and check if the driver information is returned back.
To open a connection, you MUST supply the correct connection string. Make sure the driver you specify is installed on your target machine.If you data file is protected, you can also pass in the user name and password in the connection string.