SQL Server connection middleware? - sql-server

I have an application that cannot be modified that connects to a SQL Server database using a hardcoded connection string with windows authentication.
I need to move the database to another server but as I cannot modify the hardcoded connection string - I am looking for something to act as a local connection that will then relay the query to the remote database and return the result back to the app.
The only other way I can see to do this is to upgrade from SQL Server Express and use database replication but that will be expensive option for what I need.
Can anyone suggest any software to do this or recommend an alternative method?
Thanks
Update:
The connection string also uses Windows authentication which will not work on the remote server.

If your workstations don't need access to the old server, you could perhaps solve this with DNS, using a cname record to point the old server name to the new. If you can't do this organization wide, you might be able to use entries in the hosts file on the impacted workstations.
I just saw this in the comments:
the database server is the same machine where the app runs (ie, 'localhost')
In that case, you want to figure out what the connection string is using, and the hosts entry should be able to accomplish this.

In old server you can define linked server, pointing it to new one and create queries to link to remote tables; you can use different credentials for it. You may get some performance problems (esp update statements may slow down).

Related

How does the database knows which sever to query for specific data

Lets say we have postgres and mongodb server and we sharded.
How does the database knows the specific database server to query a certain record.
or do we have to implement the logic in application layer
Does it differs for sql and no sql database
databases are divided into two parts.
server and client.
you can have few installed servers on the same machine and even a few on another machine, but every time you wanna use a client you will have to connect to a specific server.
if you connect your app to some DB - your app will act as a client, so you will have to connect from your app to some specific server by specifying a network address and port number.
Either your client/app server can decide which database server to direct the query to based on application-embedded logic, or you can have a coordinator node which your client connects to and which then routes the query as appropriate, based on look-up tables it keeps, and makes it all transparent to the client.
It is your hypothetical setup, we can't know what you did; you have to tell us. Did you use some commercial or open-source add-on to implement this?

Connecting MS Access to SQL Server on a network

I have SQL Server Express on a windows server. I have 10 people with MS Access 2016 on the local PCs. assuming that the db is very small and simple. What is the simplest way to connect to SQL Server? Will simple ODBC work? Do I need to enable remote access? TCP/IP? Pipes?
Yes, the basic concept here is to use linked tables. It not clear if before using SQL server, you were using Access in a mutlti-user mode.
The general idea here is you have a split database. So you have the application part or so called front end. This concept is really no different than say running word, or excel. These applications are installed on each workstation. But THEN the application can use some file.
So, in a typical multi-user Access applications, you have your application part installed on each machine (the front end).
Then you will typical place the back end file in some folder on the server. And then your front end will have linked tables to the back end.
If you adopt sql server for the back end? Then the setup is really the same as above. You have the front end application part that you install on each machine, and you have linked tables like before. The only difference is now your linked tables are pointing to SQL server.
So, yes you do have to enable TCP/IP for SQL server. You also have to decide if you going to use windows authentication for the users (that is windows logon). You can really only from a practical use case use windows authentication if you have a domain controller. (A computer that manages permissions to all your computers). If you are not sure or don’t have a domain? Well then you will need to create and use SQL server logons. Most often, you can create one logon/user for SQL server and have all of the access FE use this one logon. (so once again, you link the FE’s using the Access linked table manager, and you use + save this logon during the linking process).
As as a standard approach, how your application will work is really the same when using SQL server or not. In these use case examples, you use linked tables in the front end. In fact if you had a access back end, and now use SQL server for the back end, then all your forms and even the VBA code should work as before. There are often some “minor” changes to code that uses recordets, but the forms etc. should work as before.
ODBC is the simple and proven method.
Sidenote:
Consider the method using a script and a shortcut to distribute the frontend to the users as described in my article:
Deploy and update a Microsoft Access application with one click

Redirect SQL connection without changing connection string

We have a single SQL server hosting 2 instances. One instance just cannot be upgraded do to legacy software. A separate project is addressing that but is over a year away. The second instance can be upgraded, but there are thousands of Excel workbooks pointing to it for reporting purposes. So in short neither connection string can be changed at this time.
Is it possible to redirect a connection from one instance to another on a second server while keeping the connection strings the same?
I need a connection from SqlServer\Instance1 to stay on that instance while SqlServer\Instance2 goes to SqlServer2\Instance2
Creative solutions may work but need to be rock solid and maintenance light.
I believe what you may be looking for has something to do with tunnels. SQL server configuration manager > SQL Native XX.X Configuration. Here, you can specify alias for instances.
Go nuts!
Please keep in mind that you might need to get your network admin involved if both DNS name are being used at the same time. A local DHCP entry can help you come up with a proof of concept. This tunnel works for instances.

Strategies for distributing SQL-server-based application

I have written an application in vb.net, based on SSCE. Now I need to shift in SQL Server Express because I need to run the application on Sharing (LAN) and several users need to access the database at the same time.
I am absolutely new to SQL Server. I need to know the following:
1) Do I create SQL Server DB by Adding New Item in my VS 2008? or they need to be created in SQL Server mgmt Express ONLY?
2) How do I distribute these database, same way like SSCE databses?
3) Can these databases be used like we use Access DBs in sharing (just put in the shared folder)?
4) If no to Question 3, how to set the connection string as I donot know the name of computer of the user who will install my application.
Thanks
To create a new database, the easiest thing would probably be to do
into SQL Server Management studio, open the instance of SQL Server
where the database will live, right click on the "Databases" folder
and select "New Database...". Once the database is there you can add tables and the like.
You will not distribute this database. Instead you will include a
connection string in your application that references this DB. All
data will live on a single instance.
No, you will not share this like you shared an Access Database. One
problem I have with Access is that the untrained masses are set
loose on the database to do as they please. I would give as few
people as possible access to the database. And when you give them access limit their permissions to the bare minimum they need. If you want someone to
change the data in there create an application that allows them to
modify table records as you see fit.
Take a look at this link for an explanation of how you should setup
your connection string. The connection string itself will not vary
between machines. You will just need to use the appropriate account
that has the appropriate access to the DB. You will also need to
make sure that the server where the DB is running is accessible.
Good luck!

Redirecting Database Queries to another Server

I have to move a production SQL Server database onto another server soon, and I'm keen to catch any little programs which have been written by hard coding the server name into them. I have only recently inherited the system, and there seem to be a lot of Excel files scattered around connecting in using ODBC connections.
My initial thought was to find something that redirected any SQL server requests for a particular database to the new server, but I'm not aware of any such beastie. Anyone know if such a thing exists?
Ideally, it should redirect at server level and log the source so that I can go and change it to point to the new one.
If the server name is hard coded, why not give the new server the same hostname? If it's listed in DNS set the TTL to a very low value now (2 minutes) and then when the changeover happens the downtime of moving the actual database files across will help smooth over the transition.
Alternatively you can be evil, turn the other server off and force people to fix their apps when stuff breaks - which method you choose is down to your sysadmin style.
The SQL Server Client Network library supports aliases and redirects, see How to: Create a Server Alias for Use by a Client (SQL Server Configuration Manager). The alias is global for the client machine though, meaning all applications on the client host machine will obey the alias redirect.

Resources