Psql gives "SSLv3 alert handshake error" when trying to connect to Postgresql database - windows

Using Windows 10 cmd.exe
I was using psql 7.4.6 which looks like the most recent version, but it no longer works. https://sourceforge.net/projects/psql/
I'm still waiting on IT to tell me which version of Posgresql we have. I cannot do it myself. I normally use psql to do that but psql no longer works.
I'm trying to use psql to get the current date from a Postgresql server but I get this error: "SSL Error: SSLv3 alert handshake error"
We have upgraded Postgresql at least once since psql has worked with it. Could it be psql (which hasn't been updated since 2013) no longer works without our newer Postgresql?
Is there a free Windows front end I could use to browse raw data in our Postgresql DB?
I only need read access to the DB, I do not need write access. I will not have admin access to it. The DB sites on a black box from a vendor so we cannot configure Postgresql.
The software should not require me to install any other packages like Apache, PHP, Java, etc.
Thank you!

Related

Can't connect to freshly installed MongoDB

I'm rather new to MongoDB and installed it recently using the MongoDB community server (On my Windows clinet). I set the environment variable and started the database using mongod. Everything seemed fine and I can connect to the database using the GUI of Robo3T.
But if I try to connect to the DB using the mongo command in the Terminal I get the following Error:
Failed global initialization: InvalidSSLConfiguration CertCreateCertificateChainEngine failed: Falscher Parameter.
Seems like some SSL configuration failed, but I never touched anything in the configuration file of Mongo. What can I do to connect to my database in the terminal?
It turnes out, that I get that error no matter if I try to connect to the local DB or some other IP on another Server. So I'm pretty sure the error is not caused by my local mongodb server.
Thank you for your help
I completely stopped the mongo service, removed every single file I was able to find containing mongo information. Reboot my system and install mongo anew. That was the only way I was able to fix it, since just uninstalling and reinstalling didn't do the trick.

ORA-12541 TNS :no listener on 1 specific remote database, but not on others

Some context: I'm setting up an environment to run some Ruby code our Lead wrote to connect to some remote Databases. I'm using Win10 and have WSL installed. I have installed SQL*Plus, docker, and Ruby, and am sure I have installed all the dependent gems (actually at this point I know for a fact its not a ruby problem). I'm using Docker to use a pre-built image of an Oracle Database, and I have populated it with data.
Obfuscated company DB information:
'Broken' DB (TNS no listener)
Username: W-WORK-DEV
Password: password
Host: host1
Port: 999
SID: W-WORK-DB.tech.company
'Working' DB (can connect just fine)
Username: C-OLD-DEV
Password: password
Host: host2
Port: 999
SID: C-OLD-DB.tech.company
Please note the names I have provided here are purely for obfuscation, they do not represent anything about age or even config. They are essentially the same, just different databases on different hosts. Also note this is a corporate company and would have a lot of base infrastructure for their internal network.
The issue I am having is that with the specific database I am working on, I cannot connect to it. I connect to the company intranet via a VPN (I work offsite) and have issues connecting to WORK-DB.tech.company, though I can connect to C-OLD-DB.tech.company. Methods I have tried to connect with:
Oracle SQL Developer
I have inputted all the correct jdbc strings and username / password. Have even asked other people to attempt to connect (at least 3 others). They can all access C-OLD-DB as well as W-WORK-DB. When using this method, I get The network adapter could not establish the connection.
Side note: I'm fairly sure I have connected to the DB just fine in the past, though I can't be certain because I'm fairly new to this team and have only accessed it once, if that.
SQL*Plus via WSL
I installed SQL*Plus because I think Ruby was accessing it in some capacity when running the script. I got to the point where the script was able to connect to my local docker Database, but when it tried to connect to the remote database, it would return TNS: no listener. I attempted this using sqlplus as well and got the same error.
Example:
sqlplus C-OLD-DEV/password#host2:999/C-OLD-DB.tech.company
This command works and connected to the DB jsut fine.
sqlplus W-WORK-DEV/password#host1:999/W-WORK-DB.tech.company
This command gave me TNS: no listener.
During my research I had found mentions about tnsnames.ora, sqlnet.ora, and listener.ora. I have found relevant files around the company intranet and attempted to use them in my own personal environment to no avail (one of the sqlnet.ora files actually stopped me from being able to connect to any) I found mention about a config/database.yml file related to ruby, but our code already has the database information set up and I seem to be getting to the same solution as the script when trying to manually connect via sqlplus.
Here are some relevant environment variables I have set up when doing these installs. I'm thinking that at some point when trying to set up my environment, I messed up some config that changed the way sqldeveloper or sql plus would connect to that database.
$ echo $ORACLE_HOME: /usr/lib/oracle/12.2/client64/
$ echo $TNS_ADMIN: /usr/lib/oracle/12.2/client64/network/admin
$ echo $LD_LIBRARY_PATH: /usr/lib/oracle/12.2/client64/lib
I hope I have provided all the information I have come across and have explained clearly what my issue is, if you have any questions feel free to comment about it so I can clear it up. Thank you for any and all your help.
So my problem ended up being a 'firewall/port' issue. In the end i found out that specific port I was connecting to was blocked, but I thought it was only on my system. Turns out the VPN I'm using was the issue blocking that port. Company has a Primary Data Center and a Secondary one, and apparently the SDC VPN was blocking that port from me. I switched to using the PDC VPN and it worked.
Are you using the 64 bit jdbc drivers?

PostgreSQL cannot connect: service definition not found

In Windows 10 Pro 64-bit & new installation of PostgreSQL 9.4, attempting to connect to the server in pgAdmin III results in
The service is running and the service name is correct, as seen here
I am brand new to PostgreSQL, but fwiw, I've configured a working Symfony 2.7 application to use PostgreSQL and have successfully (according to the Symfony console) created a database and its schema.
What is required to get pgAdmin to connect properly?
It turns out that the error message is grossly misleading. There is no issue with the service definition. Instead, I learned that when logged in as a user other than the user that created the PostgreSQL installation (e.g., postgres) one needs to do this at the command prompt:
runas /user:postgres "C:\Program Files\PostgreSQL\9.4\bin\pgAdmin3.exe"
There may be a more elegant solution than making the above a cmd file. I'd like to know what that is!

How to connect to aws Redshift db from mac

I am using a mac and I typically use Sequel Pro to interact with sql databases. Usually I use mysql, but I understand redshift uses Postgres.
When I try to connect to my Redshift db, should I use the IP, or the "endpoint"?
Also when I try to connect, I get this error from Sequel Pro.
Unable to connect to host {{my_db_host}}, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Can't connect to MySQL server on '{{my_db_host}}' (4)
Can anyone offer advice on how to get connected?
Thanks
You should be using the Redshift Endpoint, if you have your security group settings configured correctly. You might want to set your group to 0.0.0.0/0 during testing(this opens up your cluster to the entire internet, and you can lock it down later once it works)
You also need to make sure you have the correct ODBC/JDBC driver. I recommend either Netbeans(comes with connection driver), SQL Workbench, or Aginity Redshift. Default port is 5439.
I thikn you are using the wrong driver(a mysql driver not psql driver), becaues your error says MySQL server.
http://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-prereq.html
For mac, I believe you could also try and use the a terminal PSQL client. Something like...
psql -H endpoint.aws.com -p 5439 -U username --password

How to connect to Postgres database through Ruby's pg gem (outside of Rails)

I've been using Postgres without issue within Rails and have also been running psql without issue. However, I'm running into a problem trying to connect to the database with the pg gem.
The following code:
PG.connect
generates the error/output:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
The result is the same whether I specify various dbname: values or not or just let this default.
When I click on the little elephant icon at the top of my screen, it says "Running on port 5432" and, as I said, I can connect with psql without a problem.
I found the very similar cannot connect to Postgres (pg) database from my Ruby Script using gem "pg"(This is not rails, just pure ruby), but the answer simply said Rails works fine.
Any guidance would be appreciated. (Note: I realize I haven't entered any name/password info, but I don't have to enter than when I run psql and I gather it's not getting to the point of authentication).
You need to specify a host. It's trying to connect on a unix domain socket. The PG app doesn't listen on a unix socket (unless you configure it to) but runs on localhost:5432.
conn = PG.connect( host: 'localhost' )
It is quite likely that the actual problem is that your 'pg' gem has linked to an older version of a libpq dynamic library. See this post for more details and a possible solution.

Resources