Next Topic

Previous Topic

Book Contents

Connect

bool Connect(string sConnectString,int iClientType=TLuaDB.CLIENT_ODBC)

Return values

True if the connection was successfully executed, false if an error occurred.

Parameters

Remarks

The connect string is client specific , below are the currently supported clients.

CLIENT _ODBC

Connect string example:

sConnectString = "DSN=test;UID=test;PWD=test";

This connect string uses a datasource named test and supplies the username (UID) and password (PWD) to the DSN.

If no username and password is needed the connect can be formated like this.

sConnectString = "DSN=test;";

Network Monitor is executing as a service, the datasource needs to be a system datasource. This is different from the IDE that can utilize user DSN as well.

CLIENT _SQLSERVER

Connect string example:

sConnectString = "myserver@mydatabase";

To connect to a named instance of SQL Server 2000:

sConnectString = "myserver\\instance_name@mydatabase";

CLIENT_MYSQL

Connect string example (using the default 3306 port):

sConnectString =  myserver@mydatabase

Connecting to a server listening to a custom port

sConnectString = "myserver:portnumber@mydatabase";

Note that the MySQL client library needs to be installed ("MySQL Workbench" or "Connector/C (libmysql)") and included in the default Windows system PATH variable so it may be found by Network Monitor and the IDE.