Steps to run an SQL Server database application - sql-server

I need to run my application on network. The application is based on SQL Server DB.
I have created my databases and stored them in the data directory of my application. Setup shall copy them to the application folder. Upto here it is fine. Please guide me about the following:
1) I guide my user to attach the databases to SQLExpress instance of the server and give all access from SSMS. Am I right?
2) Then user installs application on on client computer. I can set it so that application prompts for server name where to connect to access the data.
How to get this name? How can I know how the user has setup the SQL Server Express and what instances has been made?
3) If I use .\SQLExpress as server name and instance, will it work? What if there are more than one servers installed. Where will my .\ take my connection to?
4) What if there is already an instance in the Client's computer. Will my .\SQLExpress portion still go to server or try to find the database on local computer?
Off course database is not attached on local computer and there will be an error.
I am really confused. Please help.
Thanks a lot.

Yes, but the user should have rights to do that and have to know how to do that.
You should try to connect to DB or leave it on user's responsibility - to provide a valid sql server instance address
Instead of dot (.) use real name of computer or its IP address, and you'll never be confused:
COMPUTERNAME\SqlExpress
If you properly set up the connection string - the app will never interfere with other instances of Sql Server anywhere

Related

Getting Error 18451: Only, or Error: 17810 when making multiple calls to database

I'm new to SQL Server. I was a postgres user before. I installed the default SQL Server on my local machine and I'm trying to get an old react with node js application of mine working with a SQL Server. When ever my frontend makes more than 1 call to the backend, if my SQL Server has admin privileges it throws
Error: 17810: Could not connect because the maximum number of '1' dedicated administrator connections already exists.
If not, it throws:
Error 18451: Only administrators may connect at this time.
I checked my database configs and it's set to MULTI_USERS, so I don't understand why I can't login without admin privileges. Can someone help me with this? I wasn't able to find anything online.
My NodeJS backend is using TypeORM to connect to the database
The dedicated administrator connection is a different kind of connection. It's not just "a connection being made by someone with administrative access". You would use the DAC when the SQL instance is having some kind problem, and you can't connect at all because resources are all tied up. SQL will reserve some resources especially for the DAC connection to make sure you can still connect.
A DAC connection can be made by specifying ADMIN: as part of your connection string, which will connect to the assigned DAC port.
You shouldn't use this for "routine" admin work. Just connect using a login with the required administrative server roles (eg, sysadmin). You definitely shouldn't use this as part of a regular application's connection string. You shouldn't be using a SQL Server sysadmin login either. Create a user with the appropriate permissions for your application, and don't use the admin connection.
Regarding your second issue: Make sure the instance wasn't set to start in single user or minimum configuration mode using startup flags. Note that this is for the whole instance, it's not the same as the configuration for an individual database.

Application deployment failed when connecting with the database

I have just finished the development of my application on asp.net mvc connected with SQL server, and I will love to deploy it. I want to use Azure App service, but I got an error "Unable to connect to master or target server 'DATABASE_NAME'. You must have a user with the same password in master or target server 'DATABASE_NAME'". I have tried every thing I found online like modifying the SSDT, but nothing changed.
Please is there any recommendation to fix this issue? If not, Please what are other ways for me to launch the application. The application will be used internally for Sales purpose and I don't need any fancy hosting. Thank you in advance.
Did you setup the sql azure firewall to accept connections from your computer?
Even if you set it up once, it is possible that your internet provider attributed a different IP address to your computer. So you must redo your firewall set up again for your computer to be accepted.
It is important to know that only sql logins/passwords are accepted here. So you must give the login/password of the admin user that you mentioned at the moment of creation of you sql server azure (there is a step that sets it up when you create your azure database), or the login/password of a user you created and granted in this database.

Connect to SQL Express After Changing Computer Name and User Name

I have been running SQL Express on my local machine as part of a development environment for web development, but due to corporate requirements, recently had to change the computer name to join the new company domain. I also had to change my login/username as part of this process.
Because of this, I am no longer able to connect to my SQL Express instance, which i need to continue development. How can I migrate the existing SQL instance, which I connected to via Windows Authentication?
Let SQL Server engine works with Local System Account
as next:-
Press Window Button + R.
Type services.msc , then click Ok.
Select SQL Server Service , then choose properties.
Go to second tab Log On , then check Local System Account
Hope it helps.
Please try .\SQLEXPRESS instead of YourComputerName\SQLEXPRESS in server name.

VS2013 Project MS access and SQL server synchronization

I will try make this question clear as possible.
I have not found solid help on google really or anywhere else.
To make it short and simple.
I have a vb.net project in which i want two databases.
A local access database which must be created within the project at design, meaning at publishing and then installing this program to another user it must automatically create an acccess database on that user's computer,sync it with a SQL remote server and copy all records at first time run to the access database. The access database is used when my worker is on site and there is no connection to the remote SQL Server database.
Upon achieving connection to the remote SQL Server database at e.g. the office, the access db must update the SQL server database,compare the two databases and copy any new records in the local (Access Db) to the remote sql server and vice versa.
Hope this is clear enough?
Thanks for any help

How to Access Database hosted on localhost sql server 2008r2 by another computer in LAN

I created a windows form application in which I used an SQL server database.
It is working fine on my computer. Now I want to run this application on another computer that is connected with LAN with my computer.
The problem is both application must share the same database. I don't want to host my database online.
Please tell me how to access the same database from different computers by using LAN or another technique.
You will have to set up the SQL server to allow access from within the LAN.
You may also have to set up the firewall on your server to allow access to the SQL server port(s), usually 1433 1434 for MS SQL server.
Then point your application on the client machines to the server's IP address within your lan. Usually something like 192.168.xxx.xxx
Find the folder where your DB files are. SHARE that folder to 'Everyone' in network.
Turn*Off* Windows Firewall (this can be a problem sometimes when it's turned on).
Be sure that your second PC has the same ConnectionString (ServerName, ex. //PC-NAME/SQLEXPRESS) and is watching into your 'server' computer (PC with database on it).

Resources