using sql server managment studio I can connect database using sever authentication with
login = sa , password = 1
But I cant connect using server explorer (and from web app) in visual studio.
<add name="DefaultConnection" connectionString="Server=localhost;Database=XXX.mdf;Integrated Security=False;User Id=sa;Password=1"
providerName="System.Data.SqlClient" />
login failed for user sa
Can somebody answer this strange behavior?
I have 64bit Enterprize edition. Thanks.
Database=XXX.mdf
Is your database actually called XXX.mdf? I suspect it isn't, since that looks like a file name, and is perhaps just called XXX instead. The login will fail if the database isn't correct, since the server isn't going to give information about the failure to an unauthenticated user. Try:
Database=XXX
Related
I have a web application in visual studio 2017 .NET framework 4.7.1 with identity, that connects to azure sql server database. I am getting an error after submitting login form. The exception message is:
"Server name cannot be determined. It must appear as the first segment of the server's dns name (servername.database.windows.net). Some libraries do not send the server name, in which case the server name must be included as part of the user name (username#servername). In addition, if both formats are used, the server names must match."
The error is only in the web server (azure app service). When I run it locally (localhost) it works fine.
I did what error message suggests but, it did´nt work. I searched about this but, none of the suggestions or solutions I found have worked.
If I remove login stuff, application is able to connect and works so, the problem seems to be the connection string I use to connect to identity tables.
I have tried this connection strings in web.config but none of them have worked:
1.
add name="DefaultConnection" connectionString="Server=tcp:myServer.database.windows.net,1433;Initial Catalog=myDatabase;Persist Security Info=False;User ID=myUser#myServer;Password=myPassword;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False" providerName="System.Data.SqlClient"
2.
add name="DefaultConnection" connectionString="Data Source=myServer.database.windows.net;Initial Catalog=myDatabase;Integrated Security=False;User Id=myUser;Password=myPassword;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"
First, did you set the Allow access to Azrue Service ON?
Please check your Azrue SQL Database firewall settings on portal:
Second, get the correct connection string:
Others, please see: Troubleshooting connectivity issues with Microsoft Azure SQL Database.
Hope this can helps.
I'm trying to configure a DotNetNuke 7 (DNN 7) but the following error occur
ERROR:Index #: 0
Source: .Net SqlClient Data Provider
Class: 20
Number: 2
Message:
the database is SQL server 2008 R2, both database and web server on localhost. I checked the username and all instruction in the following like carefully but nothing changed
the installation guide link
http://www.dnnsoftware.com/community/learn/video-library/view-video/video/515/view/details/dnn-7-0-installation-part-1-file-system-configuration
Check to verify that you SQL Server instance name is the Default instance, if it isn't, you'll need to change the name when connecting to it.
Something like "localhost" would work for the default instance, but if you named it something else, you would use "localhost/somethingelse"
You also should attempt to connect to your DB server using SQL Server Management Studio, with the exact same information you are trying to use in DNN.
This is an elder question, but hopefully somebody benefits from this answer.
My connection string in DNN's web.config looks like this:
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
This is an SQL Server 2016 Express instance. The MDF file will be in the App_Data folder of the DNN installation.
I just installed SQL Server 2012 Express edition on my computer (Windows 8).
When I try to create a database from the Management studio, I'm getting the following error:
Create failed for Database 'TestDB'. (Microsoft.SqlServer.Smo)
CREATE DATABASE permission denied in database 'master'.
(Microsoft SQL Server, Error: 262)
When I try to access it from the visual studio, I'm getting the following similar error message:
CREATE DATABASE permission denied in database 'master'.
Is there any reason for that? I can't even access the engine from the management studio.
EDIT
Here's my connection string
<add name="DefaultConnection"
connectionString="Data Source=localhost\sqlexpress;Initial
Catalog=OptimumWeightDB;Integrated Security=True;
Integrated Security=True;
User Id=sa;Password=mypassword" "
providerName="System.Data.SqlClient" />
This is the context class
public class OWDbContext : DbContext
{
public OWDbContext()
: base("DefaultConnection") { }
}
First of all. Try to log into SQL Management Studio on your SQL Server using Windows Authentication.
If you can create database / manipulate database using you windows account there maybe a problem on the security set up on your sa login account.
Then try to re create / create new login account and set its permission to db admin.
Other thing make sure that SQL server Authentication is Enabled on your SQL Server.
When you already connected to your SQL Server using Windows Authentication right click your SQL Server > Properties > Security > SQL server and Windows Authentication mode.
also change your connection string to
Data Source=localhost\sqlexpress; Initial Catalog=OptimumWeightDB; user=yourloginname; password=yourpassword;
Best Regards
I'm having trouble trying to get Visual Studio to connect to a database located on another server.
Here is my connection string :
<add name="CDDMSDB" connectionString="Database=CDDMS;Server=aecl-db01.domainx.local;Integrated Security=SSPI;Connection Timeout=7200"
providerName="System.Data.SqlClient" />
Now when I try to connect via my app, I get the following error :
Login failed for user 'DOMAINX\CDSDEV_NATHANIE$'.
The Account DOMAINX\CDSDEV_NATHANIE, does not exist. I am logged in under the account empower\nathanielp, but it does not seem to be using that account at all. I can connect to the SQL Server through Management Studio just fine using empower\nathanielp, but for whatever reason its not using that account when I run the app.
Any suggestions?
Thanks,
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring%28VS.71%29.aspx
According to this it is pulling your windows account credentials when you are trying to log into the database and that could explain the "The Account DOMAINX\CDSDEV_NATHANIE, does not exist." IF your windows account credentials doesn't exist on the server you are connecting too.
I would set Integrated Security=false and put the username and password you are logging into the server under in your connection string. using User ID= and Password= Hope this helps.
first I have checked that Server Authentication is already set to:
"SQL server and Windows Authentication mode" (mixed mode)
้here 's my web.config connectionstring
<connectionStrings>
<add name="StockConnectionString" connectionString="Data Source=192.168.0.2;Initial Catalog=Stock;Persist Security Info=True;User ID=op;Password=operator" providerName="System.Data.SqlClient"/>
</connectionStrings>
Whene I test running (ctrl+F5) under VS2010 development this can connect to remote SQL server without any problem. but when i publish this project to local IIS (same web.config) an error occured..
Login failed for user 'op'. Reason:
Not associated with a trusted SQL
Server connection.
also i can connect to SQL server via SQL server Management Studio with SQL server authentication same user/pass.
no idea what's wrong with this.
finally, after 3 days can't figure this out. then i tried start over.
created a new project (ASP.NET MVC 2 web app) in VS2010.
go to Database Explorer > Add Connection..
use SQL server authentication to remote SQLserver directly instead of local.
then gotcha!! it told me..
this server version is not supported. you must have Microsoft SQL server 2005 or later.
my project was created under Win XP connect to SQLserver 2000 and it's work fine. now the answer for an error above is..
Visual Studio 2010 dropped support for SQL Server 2000. You'll either have to go back to VS2008/SL3, upgrade your SQL Server, or do things manually outside of Visual Studio.
...really appreciate this so much
Does it make any difference if you add this to the connection string ?
Trusted_Connection=False;
A clue is that it's saying that it's not trusted which indicates it's not using the username and password from the string. Has a connection string been possibly imported into IIS ?
Trusted is windows authentication which by the error is being used. Sql server authentication is username and password which you are trying to use.