postgresql add tag
David
I want to connect [SQLeo](http://sqleo.sourceforge.net/index.html), a cross-platform visual query tool, to a Postgresql db living on a remote server. I can do this with [DBeaver](https://dbeaver.io/) (community edition), which has connection entries for both db and SSH (so can put my credentials for both server and db).[^1] But SQLeo only gives me a single screen (see screenshot, below) for new connection details.[^2] I managed to make SQLeo "connect" with db user details (at least, it tells me that it's connected!), but I get no data—and I'm quessing this might be because no **server** credentials have been used.
 
I have follwed [these instructions](http://sqleo.sourceforge.net/guide/English_SQLeo_Help.htm#_Toc467091862) and get a connection, but no "data". That includes a screenshot of the setup screen:

![database-connection-screen](http://sqleo.sourceforge.net/guide/English_SQLeo_Help_fichiers/image003.png "SQLeo's database connection dialog")
 
Digging around, my case sounds very (very) much like [this forum query from 2012-2015](https://sourceforge.net/p/sqleo/discussion/general/thread/e75dae49/), which includes this observation (which I also see):

> SQLeo says ... wait loading and in the same time I got a warning message saying: `java.lang.NullPointerException`.

This is what makes me think there might well be a roadblock because the server credentials aren't included. Whether there is some syntax that would allow both sets of credentials to be processed is, I suppose, my question. A typical connection string for SQLeo looks like:

     jdbc:mysql://myserver.mydomain:3306/mydb

### "[X-Y][x]" postscript

What I, as a db n00b (well, I used to use Access quite a lot a decade or more ago) want to achieve is to: 

- use a (free) "visual query tool" →
- with a postgresql database →
- living on a remote server →
- where the credentials for server and database differ.

SQLeo is the closest thing I have run across that meets these requirements ... with the obvious hiccup that I can't actually get any data to query! If there is an alternative to SQLeo for this scenario, I would be glad to know.


[^1]: DBeaver's "visual query tool" is only available with the enterprise edition, which is way beyond my budget (free!) or needs.
[^2]: As noted, DBeaver's [new connection dialogs](https://dbeaver.com/docs/wiki/Create-Connection/) provide for both "db" and "ssh" credentials to be added for the db connection.

[x]: https://en.wikipedia.org/wiki/XY_problem
Top Answer
David
With some [pointers from the SQLeo developer][d], I managed to sort this. The more generic form of my problem is **using an SSH tunnel to connect securely to a remote database**. 

In fact, it was the [Postgresql help on SSH tunnels][p] that got me over the line on this. I came up with a command line (in terminal shell on Ubuntu) that looks like this:

    $ ssh -L 63333:localhost:5432 serverid@example.com -p 22

where `serverid` is my login identity on the remote machine, `-p` prompts for password authentication, and `22` is the port I login to.

Then, in SQLeo, my connection profile looks like this:

    jdbc:postgresql://localhost:63333/dbname

and also includes my distinct database user credentials. 

Clearly this is a more generic problem than simply SQLeo and Postgresql (and also works with the [SQuirreL SQL client][s], in fact). In my web-searching, there are variations of this question for all sorts of platforms and databases. The solutions, though, are much of a muchness, and this was a relatively simple solution, once I found it. Other alternatives (for example, with ["Jsch"][j], or its [recent][r] [fork][f]) were beyond my ken, and a little more cumbersome. 

[p]: https://www.postgresql.org/docs/9.1/ssh-tunnels.html
[d]: https://sourceforge.net/p/sqleo/discussion/general/thread/622c79e069/#76c7
[j]: http://www.jcraft.com/jsch/
[r]: http://www.matez.de/index.php/2020/06/22/the-future-of-jsch-without-ssh-rsa/
[f]: https://github.com/mwiede/jsch
[s]: http://squirrel-sql.sourceforge.net/

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.