Trying to connect to SQL server EF error: 'The keyword 'Network Library' is not supported on this platform - sql-server

Full Error: System.NotSupportedException: 'The keyword 'Network Library' is not supported on this platform, prefix the 'Data Source' with the protocol desired instead ('tcp:' for a TCP connection, or 'np:' for a Named Pipe connection).'
Connection string: "Data Source=tcp:88.88.88.88,1433;Network Library=DBMSSOCN;Initial Catalog=ManagerZ;User ID=....;Password=....;"
Im using ASP trying to connect to sql server db i host on my computer. I tried prefixing but i dont get it how i should do because i still get the error only using EF Core. On my desktop app with SqlClient everything works. Im also allowing tcp connections trough my firewall. Any ideas?

Found the fix had change the connection string:
"Data Source=88.88.888.8888,1433;Initial Catalog=ManagerZ; Integrated Security=False;User ID=....;Password=....;"

Aniki your answer is correct but lets point out that in the new string you must remove "Network Library=DBMSSOCN" from the connection string.

Related

How to connect remotely with Sybase SQLAnywhere.SAConnection?

I'm trying to connect with .net to a remote sybase sql anywhere database.
I don't see much info online how to connect, mostly ODBC or DSN files.
I tried this connection string:
Data Source=myserver.com;Port=2638;Uid=myuser;Pwd=mypass
Which gives the following error
Invalid connection string. Invalid or missing keyword near 'Port'
Parameter name: connectionString
So I tried to include the port with the server, like this:
Data Source=myserver.com:2638;Uid=myuser;Pwd=mypass
Which gives a new error:
DSN 'myserver:2638' does not exist
So, what is the correct connection string?
PS. Using sybase central, I was able to connect to the database, so it's not a network / firewall / port issue.
Thanks!
You want to use HOST=myserver.com:2638;uid=myuser;pwd=mypass. The list of valid connection parameters is documented here.

Lazarus (Pascal) How to connect to SQL Server using ODBC or TMSSQLConnection?

I am using SQL Server 2008 R2 and my PC is 32 bit. I created an ODBC Data Source in the "Administrative Tools". I used the server name (My PC name)\SQL2008R2 which is the instance name and I used Windows Authentication instead of using username and password.
In Lazarus, I used the ODBC Connection and when I try to set the property "Connected" to true I get this error:
And I tried to use also the SQL Server connection with the "dblib.dll" and got an error.
Note: I tried to paste the dll file in C:\Windows\System32 folder and in the C:\lazarus but still getting same error.
I've no experience with Pascal/Lazarus, but the ODBC error message in the first screenshot suggests that the property names in the Lazarus configuration screen don't match the property names used by ODBC; the error says:
Could not connect with connection string "DSN=jbs..."
Based on the screenshot of your ODBC system DSN, the DSN name is DBSource. Try setting value of the DatabaseName to DBSource in the Lazarus ODBC connection configuration screen.

Connecting to SQL Server over network using ADO from Excel VBA

I need to connect to a SQL Server DB running on my laptop from another computer on a network. I am doing this both from a C# app as well as in a VBA macro. Both run perfectly on my laptop and the C# app runs perfectly over the network. However I cannot connect using VBA over the network. This is my connection string:
ConnectionString = "Driver={SQL Server};Server=MY-LAPTOP; DAtabase=SAFEXlive; UID = MyUsername; PWD=MyPassword"
Aside from the 'Driver={SQL Server}' this is the same as the connection string I am using in the C# app which works.
I am then using the following code (With a reference to Microsoft ActiveX Data Objects 6.0 Library in VBE) to open the connection:
Dim oConnection As Connection
Set oConnection = New Connection
oConnection.ConnectionString = strConnectionString
oConnection.Open
This works correctly if I run it on my laptop but if I run it on another computer on the network I get the error: "Run-time error '-2147217843 (80040e4d) [Microsoft][ODBC Server Driver][SQL Server]Login failed for user..." and the user it specifies it the windows log in for the computer.
Are there some security settings I need to set in code or in excel? Or am I constructing the connection string incorrectly? What am I doing wrong?
Solved. The answer is rather infuriating. The problem is in fact with the connection string, with the UID. Believe it or not changing ...UID= MyUsername;... to ..UID=MyUsername;..., i.e. removing the space character, was all it took! Thanks for suggestions though.
Try this Connection string,
ConnectionString = "Provider=SQLOLEDB;Data Source=MY-LAPTOP;Initial Catalog=SAFEXlive;User ID=MyUsername;Password=MyPassword"
Is this an AD Domain login? Make sure you have appended the domain to the username e.g, domain\user .
I suggest using integrated security instead of this.

Connection failure - ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10061)

I've been looking all over the internet for an answer, and I didn't find anything.
I am trying på make a connection between Visual Studio 2010 Ultimate and SQL Server Management Studio. I just made a small program just to see if the connection works.
Everytime I'm trying to connect, VS throws an ODBCexception.
"ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server
on 'localhost' (10061)"
This is my connectionstring:
DRIVER={MySQL ODBC 3.51 Driver};Data Source=MY-USERNAME\\SQLEXPRESS;Initial Catalog=MY-DATABASE;Integrated Security=True
This connection string was copied from a data connection I've made inside VS.
Do any one have the magic solution???
Please and thank you! :)
Best regards!
Right now, you're mixing the MySQL driver (DRIVER={MySQL ODBC 3.51 Driver}) with a Microsoft SQL Server Express server name (Data Source=MY-USERNAME\\SQLEXPRESS;) - which one do you really want to connect to??
If you want to connect to SQL Server Express (which comes bundled with Visual Studio), you need to use the native .NET SQL client (and not the ODBC stuff).
In that case, your connection string would be something like:
server=YourMachine\\SQLEXPRESS;Database=MYDATABASE;Integrated Security=True
or something similar - see ConnectionStrings.com for tons of samples.
In this case, you should use classes like SqlConnection, SqlCommand, SqlDataReader from the System.Data.SqlClient namespace in your application.
This question is old but here is to guide anyone who had a problem like mine. In setting up Diafaan SMS server, i had the same problem. The problem was in the syntax. Note that in declaring the Server, Database, User and Password do not use quotes. That is why the error says 'localhost' remove all the single quotes from your connection string.
Driver={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE= yourdatabase;User= root;Password = yourpassword;
Make sure your 3306 port is not blocked even if you are connecting to a remote MySql database. I got into same issue and it resolved once we opened the 3306 port.

IIS 7 can't connect to SQLServer 2008

Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I get the following classical error:
A network-related or instance-specific
error occurred while establishing a
connection to SQL Server. The server
was not found or was not accessible.
Verify that the instance name is
correct and that SQL Server is
configured to allow remote
connections. (provider: SQL Network
Interfaces, error: 26 - Error Locating
Server/Instance Specified)
Under SQLServer, Allow remote connections is checked. My connection string is:
Data Source=.\MSSQLSERVER;Initial Catalog=mydbname;User Id=sa;Password=mypassword
I also tried with no username/password and "Integrated Security=true". There is only one instance of SQLServer installed.
I tried to access my web page locally and remotely. There is no active firewall on the virtual machine.
Make sure you have TCP/IP set up as a transport in your SQL Server configuration tool.
Thanks guys for the try. I found the solution and it is related to an info that I forgot to give. I hope it can help someone as new as me on these things.
I use NHibernate, and the connection string is actually in the nhibernate.cfg.xml file. The one in the web.config file is actually used by my various providers (users/roles). I fixed that by removing the connection string from the NH config file. I now retrieve it with:
string connectionString = ConfigurationManager.
ConnectionStrings["myConnectString"].ConnectionString;
and I set it in NH with:
Configuration cfg = new Configuration();
cfg.Configure(cfgFile);
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, connectionString);
Now I get:
Cannot open database "mydb"
requested by the login. The login
failed. Login failed for user 'NT
AUTHORITY\NETWORK SERVICE'.
But this is another story, for another question if I can't find the answer.
PS: I had to use "." as the server name otherwise .\MSSQLSERVER was producing a new error "invalid connection string". Thx Ian and Jared for the tip.
is that the actual data source line from the web config?
If so then it's should be in quotes of course, for safety add a ; on the end and check that is the actual name of your instance, you can check windows services for your instance name.
try substituting localhost instead of . and can you connect from sql server management studio using the credentials in your connection string?
As mentioned by Robert, try:
ConnectionString="Data Source=(LOCAL)\MSSQLSERVER;Initial Catalog=mydbname;User ID=sa;Password=mypassword"
I'm not sure if connection strings are case sensitve, but I notice that you have 'Id' instead of 'ID'.
Edit:
Am not sure if you need \MSSQLSERVER?
are you sure it's a named instance of SQL?
try
Data Source=.;Initial Catalog=mydbname;User Id=sa;Password=mypassword
UPDATE:
from this site
did you try the following:
Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
Make sure SQL Browser service is running on the server.
If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Well I am facing the same above issue since morning (past 8 hours) did lots of stuff like create a Domain Name, setup a new application pool identity but nothing worked :(
I just made a small changes in web.config file for connection string that is:
Integrated Security=False instead of True... and now it is working perfectly

Resources