admin 發表於 2017-12-17 09:33:57

MySQL - ODBC Connection

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:

;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)

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 etc. on hMySql and you should be all set.
Also have a look at the documentation ccod.pdf delivered with TD.
頁: [1]
查看完整版本: MySQL - ODBC Connection