查看: 1086|回复: 5
|
请问 VB 要怎样Link去WebServer 的MySQL?
[复制链接]
|
|
请问 VB 6要怎样Link去WebServer 的MySQL?
如果domain 是www.xyz.com , 有MySQL database, WebServer is
Windowsbase,connectionString是不是放
- conn.ConnectionString = "
- DRIVER={MySQL ODBC 3.51 Driver};
- SERVER=http://www.xyz.com;PORT=3306;
- DATABASE=test;
- USER=test;
- PASSWORD=pass;
- OPTION=3;"
复制代码
但我试了就是link不到webserver的那个MySQL, error。 ,
Run-time error: '-2147467259 (80004005)':
Can't connect to MySQL Server on http://www.xyz.com (10060)
有什么是我搞错的吗?请帮帮忙, 谢谢。
原码,link去Localhosts。
- Dim conn As ADODB.Connection
- Set conn = New ADODB.Connection
- Dim rs As ADODB.Recordset
- Set rs = New ADODB.Recordset
- conn.CursorLocation = adUseClient
- conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
- & "SERVER=127.0.0.1;" _
- & "DATABASE=test;" _
- & "UID=user;" _
- & "PWD=pass;" _
- & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
- conn.Open
- 'conn.BeginTrans
- rs.Open "SELECT * FROM counter", conn, adOpenStatic, adLockOptimistic, adCmdText
- Do While rs.EOF = False And rs.BOF = False
- rs.MoveNext
- Loop
- 'rs.Delete
- rs.Close
- 'conn.CommitTrans
- conn.Close
- Set conn = Nothing
- Set rs = Nothing
复制代码 |
|
|
|
|
|
|
|
发表于 19-8-2006 06:59 PM
|
显示全部楼层
SERVER=http://www.xyz.com
不是打IP的吗??? |
|
|
|
|
|
|
|

楼主 |
发表于 20-8-2006 02:27 PM
|
显示全部楼层
原帖由 红发 于 19-8-2006 06:59 PM 发表
SERVER=http://www.xyz.com
不是打IP的吗???
我的webhosting没有dedicated IP, 都是shareIP的。 |
|
|
|
|
|
|
|
发表于 21-8-2006 01:42 AM
|
显示全部楼层
无法这样 link, MySQL 用的 port 和 http 不同.
SERVER=http://www.xyz.com;PORT=3306
这行已经告诉 server 用 port 80 而不是 3306, 因为你的 "http"
没有一个 IP 或 static location 是办不到的. |
|
|
|
|
|
|
|

楼主 |
发表于 21-8-2006 09:22 AM
|
显示全部楼层
我参考 http://www.connectionstrings.com/ 的范例:
MyODBC 3.51 Remote database:
"DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;"
试过SERVER=www.xyz.com , SERVER=xyz.com 也不可以。
要怎样set server呢?或有其他方法?
谢谢。 |
|
|
|
|
|
|
|
发表于 21-8-2006 07:35 PM
|
显示全部楼层
在网上看过这类的资料, 但也要有 static IP 才行, 以及 3306 的 port 对外开放. |
|
|
|
|
|
|
| |
本周最热论坛帖子
|