I have some problems with connecting to my local DB using c# System.Data.SqlClient.
Information:
- DB parameters: Name:
bazaHost:localhostInstance:bazaPort:3306Schema: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 with JDBC, so server is 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 I use conn.Open(); this happen => (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Tried:
- server=localhost then it gives => error: 40 - Could not open a connection to SQL Server
- many other stupid combinations like 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 to get rid of this error?
- Connection to freesql.org server also failed
I have no idea what to do... Sth is probably with 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!");
Some more code...
Never reached YO! :P