mysql - Can not connect to local database with c# System.Data.SqlClient -
i have problems connecting local db using c# system.data.sqlclient.
information:
- db parameters: name:
baza
host:localhost
instance:baza
port:3306
schema:world
- my connection string:
@"server=localhost\baza;password=pass;user id=root;database=world;persist security info=true"
- using: c#, system.data.sqlclient, mysql workbench
- firewall off
- succesfull conection jdbc, server working
jdbc parameters:
string url = "jdbc:mysql://localhost:3306/"; string driver = "com.mysql.jdbc.driver"; string dbname = "world"; string username = "root"; string pass = "pass";
problem:
- when use conn.open(); happen => (provider: sql network interfaces, error: 26 - error locating server/instance specified)
tried:
- server=localhost gives => error: 40 - not open connection sql server
- many other stupid combinations server=baza
- http://blogs.msdn.com/b/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx
- asp.net beginner question: how rid of error?
- connection freesql.org server failed
i have no idea do... sth server name.
edit: code:
string connstr = @"data source=localhost\baza;password=qspass;user id=root;"+ "initial catalog=world;persist security info=true"; console.writeline(connstr); sqlconnection conn = new sqlconnection(conbuild.connectionstring); conn.open(); console.writeline("yo!"); more code...
never reached yo! :p
i suppose should put answer in answer section, rather comment :)
i see jdbc connection string using mysql rather sql server.
the system.data.sqlclient namespace the.net framework data provider sql server, not mysql.
if using mysql, need use mysql ado.net driver available here:
Comments
Post a Comment