Connection with my db using pgAdmin4 - database-connection

I am study with this tutorial: https://www.youtube.com/watch?v=Ho3DKKopC2E&list=PLDmvslp_VR0xlwr5lAx2PDsZLu7oIOhpX&index=20
When I connect to db, I want to connect the db like the turorial:
But I failed, because I don't know how to do with it:
Does anyone knows how to do with it?

Adding new server steps:
1) Open pgAdmin4
2) Right click in "Servers" in Browser panel
3) Enter some meaningful name for Server eg: "PostgreSQL9.6"
4) Click on "Connection" tab
5) Enter "Host" (default is "localhost" if database is installed on your own local system otherwise IP address of system where PostgreSQL database is installed)
6) Enter "Port" (default port for PostgreSQL server is "5432")
7) Enter "Maintenance Database" name (default is "postgres")
8) Enter "User Name" (default user is "postgres")
9) Enter "Password" (Password which you gave when you installed PostgreSQL database for "postgres" user)
10) Click on CheckBox "Save password?" to save your password in pgAdmin4 for future use.
Now as you can see, "Save" button gets enable in dialog, just click on it.
You will see that your server is now listed under "Servers" and you should be connected to your database.

You are getting error because You did not specified Name for server, Click on "General" tab provide name for your server like "PostgreSQL9.6"
Refer the pgAdmin4 documents:
Connecting to server:
https://www.pgadmin.org/docs4/dev/connecting.html
Creating new server:
https://www.pgadmin.org/docs4/dev/server_dialog.html
While creating new Server you should have all the required parameters like,
Host (default is "localhost" if database is installed on local system), Port(default is "5432"), Maintenance Database Name (default is "postgres"), User Name (default is "postgres"), Password
Without above required information you can't connect to PostgreSQL database server.

localhost did no work for me, but my server ip (192.168.xx.x) address worked. The x needs to be replace with you ip address.

If you created a database from the docker, use the 'docker inspect ID_IMAGE' to see the IP address. This IP address will be put in pgadmin in the connection tab in the first input "host name/address".
If you mirrored the default postgress port on docker-compose.yml for 5432 like
ports: 5432:5432
the IP address will be input "host name/address" and will only receive this value '0.0.0.0'

Related

Connect spyder to a remote kernel via ssh tunnel

I am trying to connect spyder, running on local_machine (macOS), to a remote kernel running on compute_server (a compute node of a cluster). The compute node is not directly accessible via the internet, I can only access the cluster via login_server.
I try the following:
On compute_server I do:
python -m spyder_kernels.console
To connect another client to this kernel, use:
--existing kernel-20351.json
I copy this json file to the appropriate place on local_machine. It contains the text:
"shell_port": 46540,
"iopub_port": 39268,
"stdin_port": 40704,
"control_port": 42637,
"hb_port": 46887,
I create an ssh tunnel through login_server. On local_machine I do:
ssh -L46540:compute_server:46540 -L39268:compute_server:39268 -L40704:compute_server:40704 -L42637:compute_server:42637 -L46887:compute_server:46887 me#login_server
I start spyder on local_machine, ask it to connect to an existing kernel, enter the name of the json file, check the 'This is a remote kernel' box, enter me#login_server for Host name. I have ssh keys set up for login to login_server already.
The connection hangs. If I start the spyder kernel on login_server and omit Step 2 then it works fine, but I can't do heavy computation on login_server, I do have to work on compute_server.
Any ideas?
I believe it should work if you connect Spyder to your localhost. So at the 'This is a remote kernel' box, enter localhost for the Host name. And enter the relevant port(!).
(And add your username and password for compute_server.)

Can't connect to a firebird server on docker

I'm a macOS user and I got weird errors just to create a database with firebird. I saw that there are some dock containers with firebird that run just fine ( i was able to create databases, perform queries and so on) but when I tried to connect from my local ISQL or razorSQL client ( through JDBC), I get some weird errors like "unavailable database" or "can't open file"
I'm also not sure how ISQL CONNECT string really works because every site I saw there is a different one.
I got this docker image: ( https://hub.docker.com/r/jacobalberty/firebird/)
I created my container like this:
docker run -d --name firebird -p 3050:3050 -v /data/firebird/databases:/databases jacobalberty/firebird:2.5-ss
my docker-machine IP is:
192.168.99.100
I tried to connect like this:
CONNECT '0.0.0.0:3050://databases/test.fdb' user 'SYSDBA' password 'masterkey';
unavailable database
And also like this:
CONNECT '192.168.99.100:/databases/test.fdb' user 'SYSDBA' password 'masterkey';
connection rejected by remote interface
CONNECT '192.168.99.100:3050:/databases/test.fdb' user 'SYSDBA' password 'masterkey';
Statement failed, SQLSTATE = 08001
unavailable database
When i enter the docker container, the file is there:
root#e4212b9f9d16:/databases# pwd
/databases
root#e4212b9f9d16:/databases# ls
test.fdb
Also, I'm not sure how to check if the firebird server is running ( i guess it is cause I can 'connect' to a database inside the container'.. but the docker container is definally up and running - did a successful telnet on the ip and port)
I also tried to use the container IP (172.17.0.2) but i got a timeout
Im most familiar with mysql and SQLite never touched a firebird db before and as the user got this DB, i have to mock it, develop an app using fake data and then connect it to the real firebird (so changing the DB is not an option)
So, the standard documentation about 'create your firebird server' don't mention but you on firebird.conf, the variable RemoteBindAddress must be empty
File:
/etc/firebird/2.5/firebird.conf
Lines changed:
RemoteBindAddress =
#RemoteBindAddress = localhost
Thanks for all the
Most of your problems are your connection string, it should be <host>/<port>:<database-path-or-alias>, where leaving of /<port> will default to port 3050.
This accounts for all your problems except for
CONNECT '192.168.99.100:/databases/test.fdb' user 'SYSDBA' password 'masterkey';
connection rejected by remote interface
As that connection string is a valid one.
This error means that you were able to connect to the server, but the connection was rejected. This might - for example - happen when you use Firebird 3, but connect using a Firebird 2.5 ISQL/fbclient library, and haven't relaxed the security settings of Firebird 3 (see Legacy Authentication in the Firebird 3 release notes).
In order to find out if the server is running, use:
docker ps
In order to figure out if the server actually started, or errored out upon start, start the container without the -d and look at the log messages when it runs:
docker run --name firebird -p 3050:3050 -v /data/firebird/databases:/databases jacobalberty/firebird:2.5-ss

Error when trying to create a new local connection in SQL Developer

I just recently installed SQL Developer on Bootcamp, and tried to create a new basic connection with the following attributes:
Connection name: conn1
Username: user1
Password: ****
Connection type: basic, Role: default
Hostname: localhost
Port: 1521
SID: xe
When tested, the error was: Network adapter could not establish the connection, no matter the type of role was given, or the type of authentication. I also tried entering IP as a hostname to replace localhost, and changing port. Still same issue.
Thanks.
Hostname: localhost means that you connecting to your local database, and NOT remotely. For example, i you have created an instance on your laptop. If you have database in the server and just want to connect to it, then put the server hostname.
SID: xe seems to be incorrect at first place. you must provide the correct SID that you provided while creating the instance. Once again, if you are connecting to remote database server, then give the SID of that database you are pointing to.
You have not mentioned the database version. You should try using SERVICE_NAME. For example, in 12c, you connect using SERVICE_NAME.
Use tnsnames.ora to connect to the remote database server. you will find it in $ORACLE_HOME/bin/network/admin/tnsnames.ora make sure it has proper connection and address details.

Trying to set up postgres for ror app, getting error - fe_sendauth: no password supplied

Getting:
An error has occurred:
Error connecting to the server: fe_sendauth: no password supplied
Settings in database.yml are the same as the app setup on other machines.
How can I set things up so that I don't need a password hardcoded?
I can view the db ok using PgAdmin-III.
I'd rather not have the password in database.yml as other machines using this app don't have/need it, so it seems likely to be something about my Pg install.
You need to change your change your pg_hba.conf. Here's an example of mine:
pg_hba.conf:
TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
host all PC 127.0.0.1/32 trust
host all all ::1/128 trust
Note that trust means that anyone on address (in this case localhost) can connect as the listed user (or in this case any user of their choice). This is really only suitable for development configurations with unimportant data. Do not use this in production.
#rodrigo-zurek was spot on; you have to change the pg_hba.conf. Just want to add this answer for the OSX users because the pg_hba.conf is located in a different place by default.
sudo su - postgres
vim /Library/PostgreSQL/<YOUR_VERSION>/data/pg_hba.conf
The default will have md5 in the column METHOD, but replace all of those with trust:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
Then, open up pgAdmin III inside your Applications/PostgreSQL 9.X, right click the database (e.g. PostgreSQL 9.4 (localhost)), and click Reload Configuration. After this, I was able to rake db:create.
No password supplied means you have set it up to require password authentication and no password is being supplied. Here is documentation for 9.0: http://www.postgresql.org/docs/9.0/static/auth-methods.html
Keep in mind that local auth was changed from "ident" to "peer" in 9.1 to avoid confusion. See the 9.1 docs at http://www.postgresql.org/docs/9.1/static/auth-methods.html
Also keep in mind that this is an ordered rule set with first match governing. Furthermore local and localhost are different. Local is for local UNIX domain socket connections, while host localhost would be for network connections to localhost. So it sounds like you have some troubleshooting to do but hopefully the docs should help.
#appveyor.yml
services: postgresql
test_script:
- SET PGUSER=postgres
- SET PGPASSWORD=Password12!
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%

rails can not connect to the globale database server even host name and database are given

in my rail application,
in database.yml file I given all the fields such as host, database , username, password,and etc.. but it did not connect to the server(here am trying to connect with global database )
and it gives an error as" Access denied for user 'myappdemo'#'142.25.12.1' (using password: yes)"
when I try to connect my local host it is connected incase of host is given as "127.0.0.1"
ie host is an IP address.. but not with "localhost"

Resources