Assuming that you want to connect from a TD App (your post doesn't mention this explicitly), you can just use SqlConnect.
First off all, you need to load the ODBC-Router (sqlodb32) in your SQL.INI. It needs to be loaded before sqlws32, so that could look like this:
- [win32client.dll]
- ;ODBC
- comdll=sqlodb32
- ;Native SQLBase
- comdll=sqlws32
複製代碼
Then, you need to inform the ODBC-Router about your databases. This is done also in SQL.INI (section odbcrtr)
- [odbcrtr]
- remotedbname=<your_db_name_in_td>,DSN=<your_dsn_name>,server=<your_mysql_server>
複製代碼
<your_db_name_in_td> is a name you can pick freely (more or less). This will be the name to use as SqlDatabase.
<your_dsn_name> is the name of your ODBC-DSN.
<your_mysql_server> is the address of your mysql server.
Then, you can connect from a TD application by setting the usual Sql-Variables and calling SqlConnect:
- Set SqlDatabase = <your_db_name_in_td>
- Set SqlUser = "gupta"
- Set SqlPassword = "123456"
- Set bConnected = SqlConnect( hMySql )
複製代碼
That should be all. Use SqlPrepare[AndExecute] etc. on hMySql and you should be all set.
Also have a look at the documentation ccod.pdf delivered with TD.
|