How to launch the SQL Server service in browser - sql

I am new to SQL Server. I am doing the offline sync using SQL Server and sqlite DB. For that I followed the below tutorial SQL Server Installation. In this tutorial I am stuck on how to open the localhost service. When I run the service (localhost/AuroraSyncService.svc) in browser it shows empty.
For this I created the database AuroraSyncCn in my SQL Server Management Studio and created the new website in my IIS (internet information security).
MY coneection Strings:
<connectionStrings>
<add name="AuroraSyncCn" connectionString="Data Source=(local);Initial Catalog=SQLite-Sync.com;User ID=sa;Password=pass" providerName="System.Data.SqlClient" />
</connectionStrings>
here i tried connectionString="localhost/myservicefolde/aurorasyncservice.asmx;
Somebody help to solve this one.

From what I see your connection string should contain your database name (Initial Catalog=AuroraSyncCn).
If it's SQLExpress, instance name should probably be the same as the one mentioned by vasin1987 (server/serverinstance).
But from what I remember from ASP.NET, 'localhost' as Data Source should also be just fine.
Can you please show/write what you have in login window in MS SQL (Server name is what interest us the most):

Related

SQL Server 2008 r2 can't login

I am working on Windows Server 2003 using SQL Server 2008 R2 and the .NET Framework 4.
My problem
I can't login to my database from my website although I can login from my Management Studio
I created a login named William.
My connection string is
<add name="TestDbConnectionString"
connectionString="Data Source=(local);Initial Catalog=RESv5;User Id=William;Password=MYPASSWORD;"
providerName="System.Data.SqlClient" />
I got this error:
Login failed for user 'William'
NOTE:
The same username and password I use in the Management Studio and I can login.
Are the website, the SQL Server instance, and SSMS all running on your local machine?
If they are not the same machine, then that is probably the source of the problem: "(local)" on a different machine will mean something different than "(local)" on your own personal laptop.
Try this for the Data Source portion of the name:
Data Source=LocalServerName
... where LocalServerName is the name of the server on which the SQL Server instance is running. If the database is on your machine and the website is elsewhere, use the name of your machine for LocalServerName.
ETA: If you have more than one SQL Server instance running and the one you want is NOT named MSSQLSERVER, you would reference it like this:
Data Source=.\SQLEXPRESS
As marc_s points out, if the instance is called MSSQLSERVER, you can use (local) as you are doing, or
Data Source=.

Login failed for SQL Server user

I know this question has been asked before on here, but none of the solutions seem to have helped. I am migrating a database from one machine hosting SQL Server 2008 Express to another. Basically the exact same configuration. I backed up my database from Old Server to New Server. When I try to run my application, I'm told "Login failed for user 'sqluser'." I've compared the settings from Old Server and New Server and they are identical as far as I can tell. If it helps, here is my connection string:
<add name="RetailCrimeConnectionString" connectionString="Data Source=NewServer\SQLEXPRESS;Initial Catalog=RetailCrime;Persist Security Info=True;User ID=sqluser;Password=AwesomePassword"
providerName="System.Data.SqlClient" />
If I switch the connection string back to OldServer, my application is happy again.
The user sqluser is datareader and datawriter on RetailCrime -- just like he is on OldServer. The application is clearly connecting because the error changes to a connection error if I change the data source to something purposely incorrect. I've gone through the SQL instance settings and I think everything that needs to be enabled is enabled. I've even added a firewall exception (a step I didn't need to take on OldServer). And I have re-created the database and created a test one on NewServer with the same results.
Is there anything outside the normal fare of Google results that I may have missed? Let me know if there is any other info you need. I wasn't sure what other details to include.
Thanks!
I figured it out. It turns out that I set the server to only accept Windows authentication and not SQL Server accounts when I set it up. Once I set that in SMSS, the web application started accepting SQL login with no trouble. I came to this idea when I realized that I could connect by impersonating Windows accounts. Thanks for the ideas! Merry Christmas!
Have you created the SQL Login for sqluser and mapped it to the database user?
You only mention the database user in your question.
Try deleting "NewServer", and add "." instead. If it's not on the same machine, put IP address of NewServer in place of the ".", like "Data Source=10.10.46.15\SQLExpress". Like below:
<add name="RetailCrimeConnectionString"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=RetailCrime;Persist Security Info=True;
User ID=sqluser;Password=AwesomePassword" providerName="System.Data.SqlClient" />
You also need to make sure your TCP/IP communication is enabled. This is for 2012 but step should be similar, See steps:
On the Start menu, click All Programs > Microsoft SQL Server 2012 >
Configuration Tools > SQL Server Configuration Manager.
Click SQL Server 2012 Services.
Expand the SQL Server 2012 Network Configuration node, and then
select Protocols for MSSQLServer (SQL Instance Name).
Right-click TCP/IP, and then click Enable.
Select SQL Server 2012 Services in the tree.
Right-click SQL Server (SQL Instance Name), and then click Restart.
Update:
Last thing to try, maybe:
Go to Start > Microsoft SQL Sever 2012 folder > Configuration Tools > Open SQL Server Configuration Manager
Make sure everything on the list in SQL Server Services is not Stopped. And make sure the start Mode is set to Automatic, not manual.

SQL Server Database Connection in VS 2010

I have completed my program in MVC in VS 2010. In the connection string I have the following
<add name="RacePaceDBContext"
connectionString="data source=XX.XXX.XX.XXX,1433;Initial Catalog=RacePaceDataNew;Persist Security Info=True;User ID=user;Password=password;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient"/>
Which connects to a SQL Server running on an EC2 instance on Amazon AWS.
The program runs fine and the connection works great. The program connects and creates/reads data etc.
However, I am not sure why when I try "Connect To Database" in the server explorer on the left, and fill in the same settings it just doesn't connect. Any ideas why this would be different? As want to be able to log in and see my tables, data etc without having to log onto AWS. The same is true when I use MySQL Workbench to try connect - it gives me an error telling me the server isn't accessible.
it might firewall issue, Please make sure your client can connect to xx.xxx.xx.xxxx:1433.
You can also refer this : https://forums.aws.amazon.com/thread.jspa?messageID=435146
Hope this helpful.

Accessing Server under Windows 7 x64

we decided to start a new project using the Microsoft SQL Server R2 under Win7. I installed SQLEpress R2 on my system and it was decieded to called it BEACONExpress. At first we could not get it to run, until we had our Domain SysApp come in and set the ownership to my login. Now I was able to use SQL Management Studio to create the Database. I even added some Tables to it. Then I fired up VS 2010 and created a test program. When I try and access the new database, VS returns this error "The file can not be opened because it is being used by another process. Please close all applications that might access this file and try again."
If I attempt to create a new database under App_Data it returns this error. A network-related or instance-specific error occurered 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).
The connectionStrings in Web.config says
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename= |DataDirectory|aspnetdb.mdf;User Instance=true"
provideName=:System.Data.SqlClient" />
</connectStrings>
I found the database at C:\Program Files\Microsoft SQL Server\MSSQL10_50.BEACONEXPRESS\MSSQL\DATA\BeaconDB.mdf
I tried changing SQLEXPRESS to MSSQL10_50.BEACONEXPRESS but it had no affect. I have been reading here and on other forums trying to determine what is wrong but so far have not found an answer.
Have you verified that the Windows 7 firewall is configured to let you access the SQL Server? I had the same problem when triyng to access a database on my server at home, with Win7 x64.
Also, you should be sure to run the version SQL Server 2008 R2, because if R2 is not installed and all the updates are not installed, it will not work on Win7 x64
Maybe this link can help you:
http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/1bb10896-27ed-4469-81e0-a84f4fba68c9
http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx
Change your connection string element to
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=BeaconDB"
(Where BeaconDB is the name of your database)

Connect to database using sql server remotely

I have finished a program using sql server and visual studio using c# language .
I want to put the database on pc and the program that connected to that database on other PCs
I'm using this connection string in App.config :
<connectionStrings>
<add name="MWEConnectionString" connectionString ="integrated security=yes;initial catalog=MWDB;data source=.\sqlexpress"/>
</connectionStrings>
Should I change server name by pc external ip address?
and according to sql server Should I use windows authentication or what?
I don't know how to do it.
You should access the server by it's address by using Sql Server authentication.
Your connection string should look something like this:
connectionString="Data Source=192.168.0.5\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"
(this is just an example, your settings will probably be different).
Another example:
connectionString="Data Source=NAMEOFCOMPUTER\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"
for accessing the server by name.
You can generate a connection string for your application from Visual Studio. From Database Explorer -> Connect to Database
see:
http://connectionstrings.com/sql-server-2005
http://connectionstrings.com/sql-server-2005#p1