SQL server default instance with a different port - sql-server

One of our clients have SQL server default instance running on a non-default port. So, the connection string from our application should be servername,1234.
They don't want to create aliases on the MS SQL server.
Is there any different way our application can connect to it?
It is a default instance, so can I use servername\MSSQLServer
Thank you!

SQL Browser does not support connecting to a default instance with
servername\MSSQLServer
They don't want to create aliases on the MS SQL server.
That wouldn't help anyway. Aliases are created on the client computer, not the SQL Server.
See Create or Delete a Server Alias for Use by a Client

Related

Rename server name in SQL Server 2014 and management studio?

I use management studio and SQL Server. How to change server name from (LocalDbs)\MSSQLLocalDB to localhost? When I connect to server in connection string I want to call: server='localhost
I believe, it's not good idea to change named instance to default instance as it might conflict with existing default instance, and considering consequences. However, \InstanceName is really concern for the connection string, you could have custom port assigned to that SQL Instance so that your connection string would be server=localhost,portnumber.
Please have a look at this answer at DBA.StackExchange to learn more on connecting SQL Server with custom port and how to change the port#
If you still have concern to use port number in connection string server=localhost,portnumber. My advise is to restore the database on SQL default instance (need to be installed if not existed already), then you could re-direct the application to communicate with default SQL Instance, this case your connection string would look like server=localhost
You could do following, if you want rename the Server in any case:
sp_dropserver <old_name>;
GO
sp_addserver <new_name>, local;
GO

Redirect SQL Server Instance to a new instance?

I have a web application that connects to a SQL Server named instance as OLDSERVER\OLDINSTANCE. I need to redirect the traffic to NEWSERVER\NEWINSTANCE. I know you can redirect SQL Server database connections using the SQL Server Client Network Utility (cliconfig.exe) with an alias, but it doesn't seem to support aliasing connections with instances. Does anyone know if it's possible to redirect traffic from one instance to another?
I've tried the following with no luck:
1. Creating an alias in SQL Server Client Network Utility (both with and without the incoming instance name -- i.e. using just the server name and then with the server name and instance)
2. Modifying the hosts file to point to the new SQL Server.
Anyone have any ideas how to redirect instance traffic to another instance?
i cant comment, so i write an answer... and, why dont change the Connection String of your application?

Can someone explain why after installing SQL Server some PC gets suffix "\SQLEXPRESS" and some don't?

Can someone explain why after installation of SQL Server some PC get a suffix of \SQLEXPRESS and some don't? Is there an option to change it?
Any suggestions or tips would be appreciated.
That is the SQL Server instance name for the new SQL Server you installed. A single machine can host multiple instances of SQL Server. The naming convention you see: hostname\instance_name is used to identify the different SQL Server instances running on a single machine.
When you install SQL Server Express, the default instance name created is SQLEXPRESS.
See:
Default instance name of SQL Server Express
How to: Identify a SQL Server Express Instance
Instance Configuration
The hostname is used for machine to machine networking. That is the same name that is used for Netbios/SMB file sharing services (\\hostname) and normally resolved for TCP/IP services through DNS (http://hostname).
The hostname\instance_name is purely a SQL server naming convention. Its only purpose is to identify a running instance of SQL server. The SQL server client network libraries know how to resolve these instance names. The standard network stacks do not. This means the following do not work:
ping hostname\instance_name
\hostname\instance_name
http://hostname\instance_name
The \instance_name only works with SQL server network clients.

Microsoft SQL Server IP/server login

I have installed many SQL Server setups but I want to know how to install SQL Server without an instance name i.e. i want to connect to SQL Server with IP or server name only.
Installing an instance and connecting to an instance of SQL Server are two different things.
Every time you attempt an SQL Server installation you have to specify an instance (create a new one or select an existing one)
Connecting to an instance is a different thing.
For example if you want to connect to an instance through MS Management studio without writting the name of the instance you can define the connection in following manner:
ComputerName\IP,port
e.g:
MyPC\192.168.1.1,1433
In order to do this you need to install SQL Server as the default instance on the machine. When it is set as the default instance you no longer need to specify an instance name when connecting to it.

JDBC connect to MSSQL named instance with non-standard port

Hello guys I'm working on a project and I'm trying to connect JIRA to a MSSQL aliased or named instance. Checkout here if you don't know what i'm talking about.
Under this setup, for example, when you want to connect to a specific DB server, let's say using SQL Studio, you have to use "servername,port" as in the mssql server alias configuration, that reflects the DB instance.
What would be the connection string to use under this circunstances?
I've read about issues with this kind of setup as I'm using the JDBC driver (JIRA uses it). You can try with SQuirreL for testing this, as it uses the same driver.
Cheers!
For SQL Server JDBC you either connect to the named instance or to a specific port. If you specify both named instance and port, it will ignore the instance name.
If you want to connect to a named instance which is not running on the default port, you will need to have the SQL Server Browser service running on the server, this allows the JDBC driver to lookup the right port based on the instance name. I believe this service by default is disabled.

Resources