線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:4062
推到 Plurk!
推到 Facebook!

Delphi如何連MySQL?

答題得分者是:loverlin
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-11-03 22:44:31 IP:61.216.xxx.xxx 未訂閱
delphi 6 或delphi 5可以嗎?
miga
初階會員


發表:61
回覆:92
積分:30
註冊:2002-08-27

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-11-03 22:54:52 IP:211.74.xxx.xxx 未訂閱
嗯…可以丫… 不過要記得灌mysqlodbc哦… 醬子就可以連了…ccc.....
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-11-03 23:47:51 IP:61.216.xxx.xxx 未訂閱
已知可用MyODBC工作的程式 來至http://www.cs.ccu.edu.tw/~lyj87u/MySQL_doc/manual_ODBC.html#Which_ODBC_OS Delphi 你必須使用DBE 3.2或更新。當與MySQL連接時,設置“Don't optimize column width”(不最 佳化列寬度)選項域。另外,有一些潛在有用的delphi代碼安裝一個ODBC入口和針對 MyODBC的一個BDE的入口(BDE入口需要一個BDE Alias Editor,可以到Delphi Super Page上免 費擁有):(感謝Bryan Brunton bryan@flesherfab.com) fReg:= TRegistry.Create; fReg.OpenKey('\Software\ODBC\ODBC.INI\DocumentsFab', True); fReg.WriteString('Database', 'Documents'); fReg.WriteString('Description', ' '); fReg.WriteString('Driver', 'C:\WINNT\System32\myodbc.dll'); fReg.WriteString('Flag', '1'); fReg.WriteString('Password', ''); fReg.WriteString('Port', ' '); fReg.WriteString('Server', 'xmark'); fReg.WriteString('User', 'winuser'); fReg.OpenKey('\Software\ODBC\ODBC.INI\ODBC Data Sources', True); fReg.WriteString('DocumentsFab', 'MySQL'); fReg.CloseKey; fReg.Free; Memo1.Lines.Add('DATABASE NAME='); Memo1.Lines.Add('USER NAME='); Memo1.Lines.Add('ODBC DSN=DocumentsFab'); Memo1.Lines.Add('OPEN MODE=READ/WRITE'); Memo1.Lines.Add('BATCH COUNT=200'); Memo1.Lines.Add('LANGDRIVER='); Memo1.Lines.Add('MAX ROWS=-1'); Memo1.Lines.Add('SCHEMA CACHE DIR='); Memo1.Lines.Add('SCHEMA CACHE SIZE=8'); Memo1.Lines.Add('SCHEMA CACHE TIME=-1'); Memo1.Lines.Add('SQLPASSTHRU MODE=SHARED AUTOCOMMIT'); Memo1.Lines.Add('SQLQRYMODE='); Memo1.Lines.Add('ENABLE SCHEMA CACHE=FALSE'); Memo1.Lines.Add('ENABLE BCD=FALSE'); Memo1.Lines.Add('ROWSET SIZE=20'); Memo1.Lines.Add('BLOBS TO CACHE=64'); Memo1.Lines.Add('BLOB SIZE=32'); AliasEditor.Add('DocumentsFab','MySQL',Memo1.Lines); -------------------------------------------------------------- 看不懂,各位幫幫忙!!
jthwang
一般會員


發表:1
回覆:21
積分:4
註冊:2002-07-31

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-11-04 01:17:32 IP:203.73.xxx.xxx 未訂閱
使用mysql odbc 會有一些問題,在顯示資料可能會發生資料被截掉情形 ,最好在MYSQL odbc 設定參數打打勾就可以避免這個問題. Delphi 連結 mysql 透過MYSQL ODBC Driver ,效果不是很理想.
loverlin
一般會員


發表:1
回覆:35
積分:22
註冊:2002-07-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-11-04 09:46:32 IP:61.228.xxx.xxx 未訂閱
引言: delphi 6 或delphi 5可以嗎?
強烈建議你使用 Zeos ,支援 Delphi/Kylix ,資料庫支援 MySQL、MSSQL、PostgreSql、Interbase、Oracle8 直接存取,不需要使用 BDE 或是 ODBC ,使用簡單,功能強大~ 到http://www.zeoslib.org 或是到 http://sourceforge.net/ 搜尋 kk-boy
------
kk-boy
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2002-11-04 11:11:19 IP:61.216.xxx.xxx 未訂閱
Zeos Library Open Source http://zeoslib.sourceforge.net/zeos_zdo_main.php Components for fast access to MySql, PostgreSql, MicrosoftSQL, Oracle and Interbase SQL servers without use add-ons, such as BDE / ODBC / ADO. Besides, the components - sources of data are compatible with standard TDataset and have a number of additional features. The library consists of: 1.Low-level plain API for access to client part of MySql, PostgreSql and Interbase 2.Low-level class API for access to MySql, PostgreSql and Interbase 3.TZXXSqlDatabase components for representation of database connection 4.TZXXSqlTransact components for transaction managment 5.TZXXSqlQuery components for executing of Sql-queries and viewing/editing of the contents of simple and complex selects. 6.TZXXSqlTable components for viewing and editing of database tables 7.TZXXSqlMonitor components for viewing of outgoing queries to SQL-servers 8.TZUpdateSql components for changing/deleting/adding of queries 9.TZBatchSql for executing of Sql-scripts Library download: zeosdbo-5.3.0-prebeta6.zip http://zeoslib.sourceforge.net/download/zeosdbo-5.3.0-prebeta6.zip --------------------------------------------------------- 是不是這一個呢?
loverlin
一般會員


發表:1
回覆:35
積分:22
註冊:2002-07-15

發送簡訊給我
#7 引用回覆 回覆 發表時間:2002-11-04 20:53:31 IP:203.204.xxx.xxx 未訂閱
引言: Zeos Library Open Source http://zeoslib.sourceforge.net/zeos_zdo_main.php Components for fast access to MySql, PostgreSql, MicrosoftSQL, Oracle and Interbase SQL servers without use add-ons, such as BDE / ODBC / ADO. Besides, the components - sources of data are compatible with standard TDataset and have a number of additional features. The library consists of: 1.Low-level plain API for access to client part of MySql, PostgreSql and Interbase 2.Low-level class API for access to MySql, PostgreSql and Interbase 3.TZXXSqlDatabase components for representation of database connection 4.TZXXSqlTransact components for transaction managment 5.TZXXSqlQuery components for executing of Sql-queries and viewing/editing of the contents of simple and complex selects. 6.TZXXSqlTable components for viewing and editing of database tables 7.TZXXSqlMonitor components for viewing of outgoing queries to SQL-servers 8.TZUpdateSql components for changing/deleting/adding of queries 9.TZBatchSql for executing of Sql-scripts Library download: zeosdbo-5.3.0-prebeta6.zip http://zeoslib.sourceforge.net/download/zeosdbo-5.3.0-prebeta6.zip --------------------------------------------------------- 是不是這一個呢?
是~ 他還是一些其他的工具(zde)跟元件(zeosctrl) 你可以一些下載來用 基本上他跟 Indy 是我目前使用起來最好用又實的&不花$$的好元件 kk-boy
------
kk-boy
bookworm
中階會員


發表:63
回覆:161
積分:82
註冊:2002-08-03

發送簡訊給我
#8 引用回覆 回覆 發表時間:2002-11-04 21:16:13 IP:210.85.xxx.xxx 未訂閱
對不起,請問一下這該怎麼裝? 我點了mysql的package時,delphi跳出一個視窗說: This package appears to be in an older format. Would you like to convert it to the new format? 我該選yes還是no?這是正常的嗎? 對不起,第一次裝其它的component,沒經驗。
loverlin
一般會員


發表:1
回覆:35
積分:22
註冊:2002-07-15

發送簡訊給我
#9 引用回覆 回覆 發表時間:2002-11-04 21:20:30 IP:203.204.xxx.xxx 未訂閱
引言: 對不起,請問一下這該怎麼裝? 我點了mysql的package時,delphi跳出一個視窗說: This package appears to be in an older format. Would you like to convert it to the new format? 我該選yes還是no?這是正常的嗎? 對不起,第一次裝其它的component,沒經驗。
你選 yes 就好了~ 那是因為他的 *.dpk 格式比較舊,所以要轉換。 在解壓縮後有個 examples 的目錄,有一些範例,你可以看一下。 kk-boy
------
kk-boy
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#10 引用回覆 回覆 發表時間:2002-11-04 21:23:06 IP:61.217.xxx.xxx 未訂閱
引言: 對不起,請問一下這該怎麼裝? 我點了mysql的package時,delphi跳出一個視窗說: This package appears to be in an older format. Would you like to convert it to the new format? 我該選yes還是no?這是正常的嗎? 對不起,第一次裝其它的component,沒經驗。
我安裝好了。 若安裝有問題,請記得看install說明!Q~~
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#11 引用回覆 回覆 發表時間:2002-11-04 21:43:10 IP:61.217.xxx.xxx 未訂閱
MySQL資料庫可視化管理工具      下載請至:       http://delphi.ktop.com.tw/topic.php?TOPIC_ID=22655 「好用喔!Q~~」
bookworm
中階會員


發表:63
回覆:161
積分:82
註冊:2002-08-03

發送簡訊給我
#12 引用回覆 回覆 發表時間:2002-11-04 22:13:15 IP:210.85.xxx.xxx 未訂閱
WINDOWS INSTALL 1. Unpack the archive with components 2. Copy libmysql.dll and/or libpq.dll into your Windows/System directory 3. Edit Zeos.inc file. You may set there you language, maximum quantity of supported memo fields, etc. 4. Add to Delphi Library Path pathes to XXX, XXX\common, XXX\dbase, where XXX - ZeosDBO directory. 5. Compile and install library in Delphi 3.0, 4.0, 5.0 and C Builder 4.0 with the same version of dpk file. Install dpk files in the next sequence: ZCommonXXX, ZDbwareXXX, { ZMySqlXXX | ZPgSqlXXX | ZIbSqlXXX | ZMsSqlXXX | ZOraSqlXXX } 對不起,我看了第四點,還是看不懂。Delphi library path在哪?該怎麼 加入ZeosDBO下的common跟dbase呢?煩請指點!
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#13 引用回覆 回覆 發表時間:2002-11-04 22:20:27 IP:61.217.xxx.xxx 未訂閱
引言: WINDOWS INSTALL 1. Unpack the archive with components 2. Copy libmysql.dll and/or libpq.dll into your Windows/System directory 3. Edit Zeos.inc file. You may set there you language, maximum quantity of supported memo fields, etc. 4. Add to Delphi Library Path pathes to XXX, XXX\common, XXX\dbase, where XXX - ZeosDBO directory. 5. Compile and install library in Delphi 3.0, 4.0, 5.0 and C Builder 4.0 with the same version of dpk file. Install dpk files in the next sequence: ZCommonXXX, ZDbwareXXX, { ZMySqlXXX | ZPgSqlXXX | ZIbSqlXXX | ZMsSqlXXX | ZOraSqlXXX } 對不起,我看了第四點,還是看不懂。Delphi library path在哪?該怎麼 加入ZeosDBO下的common跟dbase呢?煩請指點!
意思是說:將以下存放Zeos元件的路徑告訴給Delphi, 例如:[依據放置位置設好這三個路徑] c:\Program Files\Borland\Delphi6\ExLib\zeosdbo\ c:\Program Files\Borland\Delphi6\ExLib\zeosdbo\common c:\Program Files\Borland\Delphi6\ExLib\zeosdbo\dbase 將以上加到Delphi中, Tools-->Evironment options-->Library-->Library path 放在此即可! 發表人 - flyup 於 2002/11/04 22:21:56
bookworm
中階會員


發表:63
回覆:161
積分:82
註冊:2002-08-03

發送簡訊給我
#14 引用回覆 回覆 發表時間:2002-11-04 23:02:23 IP:210.85.xxx.xxx 未訂閱
謝謝你,我應該把問題一次問完的。 第四點沒問題了,可是怎麼樣compile 跟install這些dpk呢? 是不是先選zeosdbo下的zcommon3、zcommon4 ...到zcommonk這樣? 還是我用錯方法了?
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#15 引用回覆 回覆 發表時間:2002-11-05 00:13:04 IP:61.217.xxx.xxx 未訂閱
引言: 謝謝你,我應該把問題一次問完的。 第四點沒問題了,可是怎麼樣compile 跟install這些dpk呢? 是不是先選zeosdbo下的zcommon3、zcommon4 ...到zcommonk這樣? 還是我用錯方法了?
你用錯方法了!加油! ------------------------------------------------------ 應該是File-->Open-->c:\Program Files\Borland\Delphi6\ExLib\zeosdbo\ 「舉例位置」-->{依序開啟ZCommon6, ZDbware6, { ZMySql6 | ZPgSql6 | ZIbSql6| ZMsSql6 | ZOraSql6 }...dpk檔[表示要給Delphi 6版本使用的]} 簡言之:做完第一個ZCommon6.dpk-->Compile-->install -->在做第二個ZDbware6.dpk......[依此類推]
bookworm
中階會員


發表:63
回覆:161
積分:82
註冊:2002-08-03

發送簡訊給我
#16 引用回覆 回覆 發表時間:2002-11-06 00:13:50 IP:202.178.xxx.xxx 未訂閱
我也照這麼做啦,還是出現錯誤訊息: Cannot load package 'ZCommon6.' It contains unit Ztoken,which is also contained in package 'dclusr60' 我哪裡做錯了? 1、解壓縮 2、將兩個檔copy到windows/system下 3、這我沒動,不知道要改什麼 4、將三個路徑加到library的path 5、compile and install那幾個檔 我在compile的時候沒問題,在install時就出現這個錯誤了 我的是delphi6 update 2,winxp 可以幫我看看嗎?謝謝!
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#17 引用回覆 回覆 發表時間:2002-11-06 01:40:10 IP:61.216.xxx.xxx 未訂閱
引言: 我也照這麼做啦,還是出現錯誤訊息: Cannot load package 'ZCommon6.' It contains unit Ztoken,which is also contained in package 'dclusr60' 我哪裡做錯了? 1、解壓縮 2、將兩個檔copy到windows/system下 3、這我沒動,不知道要改什麼 4、將三個路徑加到library的path 5、compile and install那幾個檔 我在compile的時候沒問題,在install時就出現這個錯誤了 我的是delphi6 update 2,winxp 可以幫我看看嗎?謝謝!
解決方法: 1.另外拷貝 libmysql.dll 及 libpq.dll 到 Windows/System32 資料夾 2.若之前ZCommon6.dpk封裝時,有產生之錯誤,建議到C:\Program Files\Borland\Delphi6\Projects\Bpl,找一下ZCommon6.BPL檔先行刪除, 再重新對元件做Compile-->install。
bookworm
中階會員


發表:63
回覆:161
積分:82
註冊:2002-08-03

發送簡訊給我
#18 引用回覆 回覆 發表時間:2002-11-06 21:18:14 IP:210.85.xxx.xxx 未訂閱
可以了耶,真是神奇!謝謝你的回答,真令我感動!
adam
一般會員


發表:5
回覆:20
積分:5
註冊:2002-03-12

發送簡訊給我
#19 引用回覆 回覆 發表時間:2003-10-04 15:44:56 IP:211.74.xxx.xxx 未訂閱
看了也心動, 所以小弟比照辦理.同一部pc安裝mysql and mysql-front . 請問 mysql-front這隻程式在本機run很正常, 但安裝在另一部pc上則連不上mysql主機, 這樣子算正常嗎, 還是我的方式錯誤,敬請指教.
adam
一般會員


發表:5
回覆:20
積分:5
註冊:2002-03-12

發送簡訊給我
#20 引用回覆 回覆 發表時間:2003-10-06 13:17:10 IP:211.74.xxx.xxx 未訂閱
Sorry 已經找到問題原因. 現在可正常連線了.
degr
一般會員


發表:22
回覆:36
積分:21
註冊:2002-03-25

發送簡訊給我
#21 引用回覆 回覆 發表時間:2003-10-08 08:34:17 IP:61.221.xxx.xxx 未訂閱
請問一下 有人可以從windows 連到 Linux 上面的 MYSQL 嗎 可以請問一下是怎麼連上的呢 ps; 我已安裝 mysql odbc >> 連不上 linux 上的mysql 已增加可以連接來源 >>> 連不上 linux mysql 服務已開啟 >>> 連不上 使用 SQLConnection1 >>> 連不上 有錯誤訊息 ..
系統時間:2024-04-29 4:08:48
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!