开发者

need help connecting to mysql database

0

hi need to connect to a mysql server i have set up on godaddy.com

my code is

var dbcon : IDbConnection; //port is 3303 
var connectionString : String = "Server=xxxxx.xx.xx.x; Uid=lxxxx; Pwd=xxxx; Database=lxxx;";

dbcon = new SqlConnection(connectionString); 
dbcon.Open();

however my connection is rejected, i suspect i need to put in a port number.can anyone tell me how would i 开发者_如何学JAVAspecify a port number in my connection string?? thx


usually port number are specified as part of server name. e.g. 'localhost:8808'


The SQLConnection class is used to connect to SQL Server. To connect to MySQL, you have to use the MySQL .NET Connector. When using the MySQL Connector, you should be using the class MySQLConnection. The connection string options reference should be able to help you get all the options correct. When using the MySQL connector, you don't need to specify the port unless you are using something other than the default, which is 3306.


Use

Server = <assigned-dns-name-or-ip>:3303, Uid=<youruserid>, Pwd=<yourpassword>, Database=<databasename>


String = "Server=xxxxx.xx.xx.x; Uid=lxxxx; Pwd=xxxx; Database=lxxx; Port=3303;";

Found here: http://www.connectionstrings.com/mysql

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜