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.
Related
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
I am trying to open a connection to a Microsoft SQL Server, I opened the ODBC and went to the System DSN->add->selected SQL Server. However there are no SQL Servers to connect to.
This is probably a simple fix, but this is the first time I'm dealing with microsoft SQL Server
Just type in the name of the SQL Server instance you want to connect to. If it's a default instance type the servername. If it's a named instance type in servername\instancename. You'll then be able to configure the DSN as needed.
The control for list of available servers is notoriously unreliable for what is actually available/reachable.
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.
Each member of our development team has a copy of our application's database running on a local version of SQL Server 2008 Enterprise with SP1. Everyone is able to access the database by specifying their server and instance name in their web.config file, but to best share the developer version of our web.config file, we have standardized on making connections strings generic by using integrated security and setting server property to (local). This strategy is working fine for the majority of our 64-bit Windows 7 machines but in few cases (local) isn't recognized. We have compared settings via the SQL Server Configuration Manager (namely ensuring that the named pipes protocol was enabled) and we've tried setting the "(local)" alias via SQL Server Client Network Utility, but we haven't any luck. What needs to be done in order to use (local) in our connections strings?
Trying changing the Pipe Name for your instance to "\.\pipe\sql\query".
You can find that setting by starting SQL Server Configuration Manager, and navigating to SQL Server Network Configuration > Protocols for (Instance Name) and right-clicking on Named Pipes and selecting Properties. If Named Pipes is not enabled, be sure to enable it before restarting the SQL Server service (see comment by #NoahHeldman).
When connecting to the default instance (that is, without an instance name), SQL Server uses the default port of 1433 and the default pipe name of "\.\pipe\sql\query". Changing it back to match should (hopefully) fix it.
Those machines where the database connection as (local) doesn't work is probably that way because during the database installation, the instance name was set to something specific, rather than the default of "default instance". You can change these instance names, which may resolve this issue: http://coderjournal.com/2008/02/how-to-change-instance-name-of-sql-server/.
I think this occurs when you have SQL Server Express already installed and running, and then install SQL Server Developer Edition / Standard / etc....not 100% sure though, but from what I recall, that may be the case.
I need to setup a JDBC connection string to SQL Server.
This question is similar to the the C# ADO.Net connection question. This one is specific to JDBC connection strings.
The usual format for the JDBC string is "jdbc:sqlserver://{host}:{port}".
Now, for a SQL server cluster I have a cluster name vvv\iii ({virtual server}{instance name}).
There's no problem setting up an ODBC connection through the "New Data Source to SQL Server" wizard when using the vvv\iii string as the server name. However it seems the JDBC connection string requires a specific host and port.
Is there a way to make a JDBC connect string to a SQL Server cluster?
it turns out that you can use the "instanceName" property within the JDBC string, as documented on the Microsoft Technet page in section "Named and Multiple SQL Server Instances". What worked in my case was the following string for virtual server vvv and database instance name iii:
"jdbc:sqlserver://vvv;instanceName=iii"
When using a SQL Server named instance in a cluster or stand alone environment each SQL Server instance is dynamically assigned a port number on startup. The SQL Server Browser server handles requests to each instance because each server restart could change the port number used by each instance. The first instance to start on a server reboot gets assigned 1433 but there is no guarantee if you have 2 instances that one of them will always get 1433. There are several veriables that affect the startup and recovery time it takes for an instance to start. This can change each time.
That being sad... when connecting to a named instance the jdbc connection string should look like this:
jdbc:sqlserver://server_name/db_name;instance=instance_name
rather than this
jdbc:sqlserver://server_name:1433/db_name;instance=instance_name
note that the default database "/db_name" is optional. If exclued the connection will use the default database assigned to the SQL Server login.
The cluster resource has a host name and a listening port. Use jdbc:sqlserver://{virtualserver}:1433 (or the appropriate listening port if not listening on the default one).
I'd comment Mark Stewart's remark, but the reputation is lacking. My source doesn't mention /db_name and I can't get it to work either. Maybe another case of confused instance names?
Make sure you leave the port definition off as the cluster determine this for you.
So my datasource definition looks like:
jdbc:sqlserver://sqlcluster_hostname\instancename;DATABASENAME=databasename;sendStringParametersAsUnicode=false;SelectMethod=direct
I ran into this issue while trying to setup a Railo datasource to connect to MSSQL cluster.
Slightly off topic ... The standard Railo datasource MSSQL driver option sets the port to "-1" if you leave the port field empty however if you set it to "0" then it removes the port definition altogether and then everything works. But the best way is to choose 'Other - JDBC Driver' to define the JDBC connection string in full as above.