設為首頁收藏本站

艾歐踢論壇

 找回密碼
 立即註冊

QQ登錄

只需一步,快速開始

搜索
熱搜: 活動 交友 discuz
查看: 667|回復: 0
打印 上一主題 下一主題

MySQL - ODBC Connection

[複製鏈接]
跳轉到指定樓層
樓主
發表於 2017-12-17 09:33:57 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
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:
  1. [win32client.dll]
  2. ;ODBC
  3. comdll=sqlodb32
  4. ;Native SQLBase
  5. comdll=sqlws32
複製代碼

Then, you need to inform the ODBC-Router about your databases. This is done also in SQL.INI (section odbcrtr)
  1. [odbcrtr]
  2. 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:
  1. Set SqlDatabase = <your_db_name_in_td>
  2. Set SqlUser = "gupta"
  3. Set SqlPassword = "123456"
  4. 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.
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 轉播轉播 分享分享 分享淘帖
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

小黑屋|Archiver|手機版|艾歐踢創新工坊    

GMT+8, 2024-5-16 11:50 , Processed in 0.261019 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表