Is possible to manage an OpenShift Database with pgAdmin? - database

Today I want to know if it is possible to manage a PostgreSQL on OpenShift using pgAdmin, in the same way that we can manage an Amazon RDS database?

Use port forwarding on your local machine to establish a connection to your remote server:
rhc port-forward -a applicationName
Now check the output on your command line to which port the postgres database service is mapped, if available this will be 5432 by default.
A step by step documentation about port forwarding is available at Getting Started with Port Forwarding on OpenShift.

Another way would be to configure the ssh-tunnel into your connection.
Tunnel-Host would be your applications name
Username the beginning string, when ssh'ing to that connection: XXX#application-name
Identity file would be id_rsa in .ssh fodler in your home directory
password your openshift password

Related

Connection to the database failed - server closed the connection unexpectedly. This probably means the server terminated abnormally

The rest of the error is "before or while processing the request."
I have a CentOS server running Postgres on an internal network scheme 192.168.11.0/24 for which I also have pgAdmin4 also installed and running. pgAdmin is connecting via localhost and I can successfully connect to my database.
I am running a windows 10 client on 192.168.11.100 with Lazarus trying to get a TPQConnection object to connect. This error comes up when I click the "Connected" property with all the connection information filled in.
The server is running on 192.168.11.25.
I have the Postgres client libraries extracted and in my system path (the bin directory) for the version of Postgres I'm running (12.5)
My pg_hba.conf file is set up to allow the connecton - Here are the relevant lines:
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.11.0/24 md5
# IPv6 local connections:
host all all ::1/128 md5
I've set the password for the postgres user and verified that the account works with pgAdmin.
I'm not sure if this has to do with Lazarus or if this is a postgres client library problem.
I have also tried installing the Postgres ODBC client and attempted to create a DSN and was unsuccessful with that as well. I'm guessing this could be a configuration problem on the server not sure though.
Rich
I figured it out finally - been struggling with this for 2 days! By default Postgres only listens on localhost.
I had to edit postgresql.conf listen_addresses parameter and set it to '*' or equivalent IP address if I want to be more restrictive. With the pg_hba.conf restricting from which addresses login can happen on it seems perfectly sufficient to use '*' for listen_addresses.
After that I was able to connect from Lazarus.
Rich

Connect to database through two ssh tunnels in IntelliJ IDEA

I'm trying to add a postgresql database as a datasource in IntelliJ IDEA Ultimate.
I've worked with a datasource through ONE ssh tunnel already. But now the database server is behind a firewall which only accepts ssh connections from a management server. The only way to access the db server goes over the management server.
So I (or IntelliJ) have to connect via ssh to this server and then, by using another user, tunnel via ssh to the database server.
Everything clear? :-D
The problem is, that IntelliJ offers only to configure one ssh tunnel. But after the first tunnel I need to use a second one, to finally connect to the database server...
Any Ideas?
Thx in advance.
I'd create a local port forward using OpenSSH or any similar tool which will forward 127.0.0.1:2222 to firewall:22 via the Management Server, then use IntelliJ IDEA tunnel configuration to 127.0.0.1:2222 like you would do with the single tunnel.
ssh -L 127.0.0.1:2222:firewall:22 <management server>
You can configure an External Tool to automate this process. On Windows machine I had great experience with Bitvise SSH Client for creating tunnels/port forwards and starting them automatically.
ssh supports your scenario out of the box. The trick is to create two entries in your ~/.ssh/config file for the management server, one for your-user and one for special-user. Then use ProxyJump to chain your connections together.
So, start by setting up a Host section for the management server and the user your are connecting to from your local machine:
Host mgmt
HostName management.server.com
User your-user
...
Then, set up a Host for the user on the management server that you will be logging in as:
Host mgmt-special-user
HostName management.server.com
User special-user
To this same host, add a directive to tell ssh to create a tunnel to your DB:
LocalForward <free-port-on-your-box> <db-ip-or-host>:<db-port>
Then tell ssh that this host can be reached from the first host:
ProxyJump mgmt
You can now ssh mgmt-special-user from your local machine. ssh will automatically jump through the mgmt host, and will also automatically extend the tunnel through mgmt and back to your local machine.
ProxyJump (-J) was added in OpenSSH 7.3 (released in 2016).

Cannot connect to SAP HANA Express DB using eclipse studio

I am new to SAP HANA database. I have successfully hosted the SAP HANA express database on cloud server. I have created a database and I am able to query it for the CLI.
However I have trouble connecting it from eclipse have spent two days on the same.
I am following https://developers.sap.com/india/tutorials/hxe-howto-eclipse.html tutorial.
Please Note :
I am able to connect to server using RDP and putty so the IP address is correct
I have started the database using command:
hdbsql -i 90 -d HXE -u SYSTEM -p SAPhxe123
why is eclipse taking port 39015 by default in last screenshot? is this the issue or can we change this.
Any help here would be much appreciated!
Remove the port and just keep HXE for the tenant.
39015 is the right one for the first tenant in an AWS or Azure VM (39017 is for Docker).
Try connecting to the system database first. If that works but the tenant doesn't, check this: https://developers.sap.com/tutorials/hxe-gcp-eclipse-tenant-connect.html
If that doesn't work: https://blogs.sap.com/2018/02/24/troubleshooting-connection-problems-for-hana-express/
Unless you explicitly closed port 22, ping should respond.
Also a reminder that HANA studio is part of a set of deprecated tools so if you are looking to learn native development, I would recommend going for XS advanced.
Could you please refer to following document: https://developers.sap.com/tutorials/mlb-hxe-tools-sql-eclipse.html
There the tenant database connection is created as follows
The host server (IP) is maintained in hosts file
Additionally the tenant db is only provided as HXE without port number
If you running the HANA server as a container.
Go in to the container "docker exec -it bash
HDB info
What is the port that you can connect to (If the Port is 39041 for example)
Rerun your container mapping your docker run command with -p:. That is (-p 3901:39015).
Essentially what is broken is that the port Eclipse HANA studio is trying to connect to is not mapped to the HANA port that is listening on.
You have to map the PORT that HANA is listening to Host PORT 39015.
If this is a cloud env you have to do the appropriate port forwarding.
Tested this and it works now.
For tenant database, I think it is enough to use HXE
Did you try to change the host name by adding the port information after IP address?
When your HXE instance was created on AWS, did you assigned it the default security group or did create one based on "Seller settings"?
This is really important because without this custom security group you won't be able to access your instance from the outside world.
Please refer to the following tutorial for more details: https://developers.sap.com/canada/tutorials/hxe-aws-setup.html

Connecting Jitterbit to Heroku Postgre

I'm trying to connect to Heroku Postgre using Jitterbit Cloud Data Loader.
got my connection parameters all setup but unfortunately I run into an error FATAL: no pg_hba.conf entry for host "210.213.78.5", user "u49bh1311s0496", database "dfsj8qbgvj0ram", SSL off
Would like to ask for possible solution with this.
Thank you for your help.
Whenever I connect remotely to a Heroku Postgresql database, I need to have SSL on.
You'd typically connect using the heroku domain name instead of an IP as well.
Try this as your connection string:
jdbc:postgresql://210.213.78.5:5432/dfsj8qbgvj0ram?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
with your username and password.

Connect Database to Excel via SSH tunnel

I am trying to connect Excel to my companies database but am running into problems because we use an SSH tunnel. The SSH tunnel connects to Nexcess which is where our servers are stored.
Has anyone else encountered this problem?
Any help is appreciated. Thanks!
Use putty, set up your SSH link to the server.
Under auth select 'allow agent forwarding'
In tunnels set source port to 3306 and then put the domain of your mysql server in the destination followed by :3306 (update this port number if your mysql server is on a different port obviously, but keep the local port the same)
Connect
In mysql workbench, add a new connection: localhost, port 3306, user / pass etc
Then from excel, connect away

Resources