Cannot connect to named instance of SQL Server 2008R2 - visual-studio-2010

I am attempting to create a new Database Project in VS2010 via the New Project Wizard, and via this article: http://msdn.microsoft.com/en-us/library/aa833432(v=vs.100).aspx
I am on the 'Configure Build/Deploy' step, and am attempting to connect to a named instance of SQL Server 2008R2 that I just installed, called DEVELOPMENT. Assuming the server name is DB-01, I am using DB-01\DEVELOPMENT as the Server name in the dialog in the screenshot below. I'm also using the remaining settings in the dialog, but it keeps giving me the following error:
A network-related or instance-specific error occurred while
establishing a connection to the 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:
TCP Provider, error: 0 - A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.)
DEV is the name of a database I created on the DEVELOPMENT instance. If I use DB-01 as the server name, which is the default instance, it connects. In the past, we've been developing from a database on the default instance, with no issues, but I'm trying to move to local, source-controlled databases. What am I missing with this not connecting?
EDIT: As a little more context, it's not the username/pw combination, or the existence of the DEV db on the instance, because I receive different errors if either of those are incorrect. It's simply not able to connect once I give it the named instance.

Figured it out:
The default instance of SQL Server (called MSSQLSERVER in some places) uses port 1433 by default for incoming connections, which was opened in Windows Firewall. This is why I was able to connect to the default instance (DB-01). If you've created a named instance of SQL Server, by default these instances use port 1434 for incoming connections. These are TCP ports for each case. Well, I have to admit that I opened TCP port 1434 in Windows Firewall and still was not able to connect to the named instance remotely, and still am not sure why this was the case. So instead, I opened up a random port (6969) in Windows Firewall, and configured the DEVELOPMENT (named) instance to accept incoming connecting over that port only. For instructions on how to configure specific SQL Server instances to use ports other than the default, see this article:
Configure a Server to Listen on a Specific TCP Port
Once I configured the instance to use port 6969, I was able to connect with no issue. Hope this helps others that are having a similar/same issue.

Related

Connect to Firebird database on Windows instance via CentOS

I have the task to establish a connection to a Firebird database that is located on a Windows instance. What I was able to accomplish so far was to establish a connection via PHP PDO on my local machine and query the databases.
However, I run into dead ends when I try to connect to the Firebird database that isn't on my PC locally. The database is located on a Windows remote server. The provider opened a port for that gets then redirected to port the Firebird database should be listening to as well (5143 was on my local machine and provider said it was the same on their end. So we try to connect over serveraddress:port and get forwarded to the corresponding port then).
First issue was to get Firebird working in CentOS but I got that down.
Connecting to the specified port I get the error "SQLSTATE[HY000] [335544421] connection rejected by remote interface", any other, not open port, returns correctly "connection refused".
Is it even possible to connect to a Windows remote server? Am I even "connected" / trying to connect to the Firebird database there and it gets declined then?
I read a lot about the rejected by remote interface error but nothing really pops into my mind what it can be.
I tried various setups, tried different ports, we logged on over TeamViewer and set up an ODBC connection locally on the remote desktop which succeeded. Both connections over the 32-bit and the 64-bit ODBC worked. We checked the Firebird versions and they were identical. We even tried to connect from a Windows notebook to the Windows remote.
I basically just want to establish a connection over PHP PDO.

What is the cause of this problem "IO Error: The Network Adapter could not establish the connection" on Sql Developer?

I make a connection for connect to the Database Server (other machine).
Then I found "An error was encountered performing the requested operation:
IO Error: The Network Adapter could not establish the connection
Vendor code 17002".
Please look the picture in URL below.
I tried to make a connection but can't access but my team can access it.
My friend used TNS connection type and I did everthing similar him but can't access. I tried to use JDBC thin for connect but can't also.
I had the old connection which I can connect but why I can't connect the new connection.
You're trying to connect to a machine on a network that SQL Developer is unable to reach.
For a TNS connection,
Look at the appropriate TNSNames entry (you will have a tnsnames.ora) file, and find the IP address or network name associated with the connection you're trying to establish -
And then start by trying to ping that resource.
In this case, i'm trying to talk to a database on MY machine, on port 1521. Yours should look quite different.
If you're using a basic connection, then you can look at the connection properties and see what machine/port you're trying to communicate with.
Ping
If you can't reach that machine from your machine, there's zero chance you can connect to a database there.
So, always start with a ping.
Once you see that you can get to that machine, if you're still getting that message, the next thing to think about is blocked ports, the listener defaults to port 1521, but you'll see that in the TNS descriptor as well.
It usually happens when a another process is running on the same port or there is an absence of listener.
Go to Run>services.msc>OracleXETNSListener>Start
Try to reconnect.. Even if the error still prevail then go to cmd
Use code:
npx kill-port <portnumber>
The port number by default is 1521, but you can check the port number in database properties.
It is possible, that your connection is forbidden by the firewall -
go to Control Panel\System and Security\Windows Defender Firewall - Advanced - Outbound Rules - Add a rule. (If you have some antivirus firewall, add rules there)
Create a temporary TCP rule for your port and another rule for UDP. Allow all nets and comps.
Check the telnet connection as cmd -> telnet ->
open remote.host.address PortNumber
If you can connect now, then the problem IS in firewall - edit your new rules, setting the hosts and nets exactly.
This error is because your sqldeveloper is not able to reach the database server's sql service.
One reason could be lsnrctl is down for some reason.
If you have access to machine where database is installed.
In Windows machine, follow: https://www.youtube.com/watch?v=r9pHqOfV2f0&ab_channel=TLinaTutorials
In Linux/macOS machine: Go to $ORACLE_HOME/bin and check status of lsnrctl
execute from $ORACLE_HOME/bin lsnrctl status, if it's down. Then restart it by lsnrctl start.
Check the details of connection in command output like SID, PORT, HOST etc. and try connecting again from sqldeveloper.

TeamCity Socket timeout When Creating Database

I am using TeamCity version 10.4. I am trying to create the database on my local machine.
However, I am getting this error:
The connection to the host localhost, named instance hsalman-pc failed. Error: "java.net.SocketTimeoutException: Receive timed out".
Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later,
verify that the SQL Server Browser Service is running on the host.
I have the required driver here:
Aslo, I cannot locate the database properties file in the data directory. So what is the problem?

Error Locating Server/Instance Specified using SQLNCLI10.1

following scenario with a firewall inbetween this PCs:
Client PC
IP 10.10.140.100
Subnet 255.255.0.0
Gateway: 10.10.0.254
Server PC
IP 10.40.140.100
Subnet 255.255.0.0
Gateway: 10.140.255.254
The communication itself is already working (ping, using a WebClient) so don't worry too much about that.
I'm facing a connection problem connecting to a named instance (in this case "WINCC") from the Client PC to the Server PC(SQL Server 2008 R2) using the following connection string in the application (Database name is correct, have checked that!):
strserver = "10.40.140.100"
strConnectionString = "Provider=SQLNCLI10.1;Integrated Security=SSPI; Persist Security Info=False;Initial Catalog=" & Database & ";Data Source=" & strServer & "\WINCC"
Circumstances:
Microsoft SQL Server 2008 Native Client is installed on the Client PC
The windows user used on the Client PC is existing on the Server PC and part of the necessary User Group (in this case SIMATIC HMI Group because of WinCC)
I have looked up the dynamic port used by the sql server which is 49181 and the port was opened in the firewall of the network
This has worked in every other network environment till now but something is still somehow blocking the access in the network
The script is crashing with the following error:
"SQL Server Network Interfaces: Error locating Server/Instance Specified [xFFFFFFFF]" when attempting to establish the connection to the database (.Open command).
I'm 99% sure it has to do something with a port not opened. I have seen several times that the UDP Port 1434 of the Sql Browser service has to be open for . Is this also relevant when using the SQL NAtive Client Provider? Or should I try to name the port specifically in the connection string? (Like "10.40.140.100,49181/WINCC"?)
Any comment is appreciated, thanks!
Best regards,
CMSPaul
Using a Dynamic port can often cause issues. If you have an App server connecting to the SQL server inside your network I would suggest using a Static IP on the SQL server and then route it through the firewall as defined. Also as you said I would define the TCP/IP port in your connection string.
This would be set up in SQL Server Configuration manager under SQL Server Network Configuration. Select Protocols for . Right click TCP/IP and select the IP Address tab. Make sure all TCP Dynamic Ports are set to 0. Under IPALL, set the TCP Port to the static IP address. Once that is done, you will need to restart the SQL server service.

EC2- connecting to an independently installed SQL Server Express

PLEASE NOTE: This is not an RDS or a prepackaged EC2 with SQL Server solution. I installed an express copy independently after setting up the EC2 instance.
I am evaluating a free tier instance of AWS EC2. Several months in, I decided to install SQL Server 2014 express on the instance on my own. However I cannot connect to the SQL Server instance via SSMS from another server box local to us.
The following is a checklist of what I have done so far:
SQL Server Configuration Manager
Configured to run SQL Browser
Enabled TCP on the SQL Server instance
Windows Firewall
Created an inbound rule to allow communication on TCP port 1433 and 1434
Created an inbound rule to allow communication on UDP port 1434
AWS security group of EC2 instance where SQL Instance resides
Mirrored the rules above in the Windows firewall for inbound traffic from the local server I'm trying to access the EC2 instance from
Successfully tested if RDP and ICMP work on the instance
I believe my issue lies in the how I am referring to the SQL instance:
ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com\INSTANCE_NAME
I've also noticed that when I log in on the EC2 instance's copy of SSMS, there is a two part name like so:
WIN#########\INSTANCE_NAME
Please help as I feel I've exhausted all options. This shouldn't be that impossible.

Resources