On my machine there are two instances of SQL Server
SQLEXPRESS
MSSQLSERVER
I'm trying to connect to the MSSQLSERVER, but I keep getting
{"A network-related or instance-specific error occurred while establishing a connection to 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: SQL Network Interfaces, error: 25 - Connection string is not valid)"}
Here's the connection string:
connectionString="data source=.\MSSQLSERVER;Integrated Security=SSPI;initial catalog=OdeToFoodDB"
providerName="System.Data.SqlClient"
I'm trying to get the server visible to remote connections, but it doesn't work.
doing sqlcmd -L gets me:
Servers:
(local)
MACHINE1
MACHINE1\SQLEXPRESS
which seems strange given the fact that I disabled the SQLEXPRESS service, and only left the MSSQLSERVER running.
In Configuration Manager, in Network Configuration->Protocols for MSSQLSERVER I enabled the TCP/IP and Named Pipes, and in IP Addresses the setup is as follows:
but the server is still not available for remote access (netstat -nb shows no processes listening to 1433). My windows firewall is off.
Any ideas?
If your MSSQLSERVER is the standard instance it will take the name of the machine. So you should try:
connectionString="data source=MACHINE1;Integrated Security=SSPI;initial catalog=OdeToFoodDB"
providerName="System.Data.SqlClient"
Related
I am using PostgreSQL flexible server by MSAzure.
The server is not setting any connection restriction and allows connections from all IPs.
I can access to the server with psql command normally.
psql "host=.postgres.database.azure.com port=5432 dbname=postgres user=myadmin password= sslmode=require"
However, with the Source IP anchoring function by Zscaler Internet Access, it fails.
psql: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.
I could not find the error logs from server side.
Also I checked the packet and it seems the server sends RST packet as soon as it received connection request message from client.
enter image description here
Source IP Anchoring(SIPA) is a function which fixes source IP by transferring the packet to the proxy cloud, and from proxy cloud to private VM. The VM takes over the connection to the destination server.
Client <-> Proxy Cloud <-> VM <-> sql server
So from client side, it looks like the client is connecting to the proxy cloud.
And from sql server, it seems the server is connecting to VM.
The VM only performs outbound connection and never allows inbound connection.
This means connection pushed from server to client is not supported (like P2P, Application lelvel gateway, SIP, RTSP, Bittorent).
Does Postgresql connection requires inbound connection from server to client?
I tried disabling SSL connection, but the result was same.
The client version and server version are both same.
Also I tried connecting from pgAdmin 4, but failed again.
I'll appreciate any clue on this.
There is a PostgreSQL server on a Windows computer that I need to access remotely. It's not on the local network. I'm trying to connect to it with pg_pconnect. I have an AMP stack with PHP 7.1.23 on my local Mac computer and I can connect to it just fine. (The connection works, I can make queries, etc.) When I upload the same script to a hosting provider (LAMP stack with PHP 7.1.22) the script does not work anymore.
Warning: pg_pconnect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused
Is the server running on host "x.x.x.x" and accepting
TCP/IP connections on port 5432? in /path/to/my-script on line 42
I would think that the SQL server does not allow remote connections if it didn't allow the connection from my computer either. But to that server both connections would be remote, right? So how can it allow one and not allow the other?
Turned out that the hosting provider had to whitelist the IP address first. That's why it didn't work.
I am using postgres database which is accessed by jboss and tomcat server.
My server accidentally restarted and then postgres service was not showing in the services list.
When I tried to open postgres local host server using pgadminIII it showed following error:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
If you encounter this message, please check if the server you're trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first.
For PostgreSQL servers starting with version 8.0, this is controlled using the "listen_addresses" parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use '*' to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you'll need to set the "tcpip_socket" parameter to 'true'.
You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error message, it's still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community.
Does this problem arise due to accessing same DB by two different servers?
My server accidentally restarted and then postgres service was not
showing in the services list.
You can't connect because it's not running. You can have as many clients connecting to a PostgreSQL server as your hardware can support - there is no problem with that.
Restart your PostgreSQL service. If it won't, check the logs for why. If you don't know where your PostgreSQL logs are now is a good time to find out. I can't tell you how to restart the service because you haven't said what OS you are running or how you installed PG. Check your documentation.
I am trying to use dblink to move data from one system to another. Both machines are RHEL 5.11, both running postgresql 9.2, both on the corp internal net with no firewall rules between them. I am working from my desktop vpn'ed into the corp internal net.
Call the two machines FROM and TO. The FROM machine has dblink installed as an extension, the TO machine does not. For both machines the user I am specifying has a pg_hba.conf host entry listing all for db's, 0.0.0.0/0 for address, and trust.
Using pgadmin3, I can connect to both machines from my desktop, see/add/modify databases on both. I think this rules out both trivial connection issues and permissions as potential sources of the problem.
in a pgadmin query window for the FROM machine, I execute this:
SELECT dblink_connect('AAA','host=TO dbname=XXX user=postgres password=ZZZ');
-OR-
SELECT dblink_connect('host=TO dbname=XXX user=postgres password=ZZZ');
-OR-
Either variety above entered at a psql command line on the FROM machine.
Results in this message delivered in the messages-pane or to the command line:
----- ERROR: could not establish connection DETAIL: could not connect to server: Connection timed out Is the server running on host
"TO" (AAA.BBB.CCC.DDD) and accepting TCP/IP connections on port 5432?
********** Error **********
ERROR: could not establish connection SQL state: 08001
Detail: could not connect to server: Connection timed out Is the
server running on host "TO" (AAA.BBB.CCC.DDD) and accepting TCP/IP
connections on port 5432?
Suggestions?
Update
-- tried replacing hostname "TO" with "localhost", same result.
-- however, dblink_connect('dbname_on_FROM'); works. so basic dblink functionality IS functionaing.
-- original problem remains unsolved as I want to ship data to a server on TO machine.
I am not sure if you were able to figure out the problem or not, but I am going to answer anyway. The "TO" machine's database might be running on a port different than 5432. You need to make sure the port your DB Server is running on and the port you specified in the "FROM" machine are the same.
If the port number is same, then there has to be a mistake in host, username or password when specifying these parameters in the "FROM" machine.
I try to copy file from remote server to my local machin but it gives following error
ssh: connect to host 103.241.144.137 port 22: Connection refused.
command : scp root#111.111.111:/home/msecondo/public_html/jsp/afterLogin/sachin/PHR/ /localpth/.
"Connection refused" means that there was no process accepting connections at the IP address and port that your client tried to connect to. In this case, it probably means that there is no SSH server running at 103.241.144.137 port 22. Alternately, if the SSH server is running, it may not be listening on the IP address or port that you tried to connect to.
StackOverflow isn't the right site for troubleshooting SSH server configuration. If you have administrator privileges on the remote server, then you should look into how the SSH server is configured and whether it's running. If you're not an administrator on the remote server, you should report this to the administrators so that it can be investigated.