简体   繁体   English

如何在pgAdmin中通过JDBC连接数据库?

[英]How to connect to database through JDBC in pgAdmin?

I have database connection settings and pgAdmin (it is all that i have).我有数据库连接设置和 pgAdmin(这就是我所拥有的)。 Can I connect to the database through the pgAdmin to make the necessary changes in the database using these settings?我可以通过 pgAdmin 连接到数据库以使用这些设置对数据库进行必要的更改吗? If so, how?如果是这样,怎么做?

I have not found how I can do this.我还没有找到如何做到这一点。 Other answers here (and in google too) suggest writing Java-code - this is not what i need.这里的其他答案(以及谷歌也是)建议编写 Java 代码——这不是我需要的。 I want to use pgAdmin interface for it.我想为此使用 pgAdmin 界面。 Can I make changes without using Java-code?我可以在不使用 Java 代码的情况下进行更改吗?

Here example of settings that i have:这是我拥有的设置示例:

jdbc.driverClassName - org.postgresql.Driver
jdbc.url - jdbc:postgresql://localhost:4444/
jdbc.username - username
jdbc.password - password

I don't understand why people don't understand what he's trying to do.我不明白为什么人们不明白他在做什么。 He just wants to connect to db using pgAdmin.他只想使用 pgAdmin 连接到数据库。 He just doesn't understand how to use the connection string in pgAdmin.他只是不明白如何在 pgAdmin 中使用连接字符串。

Basically, just remove all prefixes and suffixes (eg. jdbc:postgresql://).基本上,只需删除所有前缀和后缀(例如 jdbc:postgresql://)。 So your hostname is localhost.所以你的主机名是 localhost。 Type localhost in host name, 4444 in port name as well as your username and password.在主机名中输入localhost ,在端口名中输入4444以及您的用户名和密码。 Also give it a name in General tab Then you'll see the databases on the left.还在常规选项卡中为其命名然后您将在左侧看到数据库。 Click Tools > Query Tool and write your select/insert etc. scripts.单击Tools > Query Tool并编写您的选择/插入等脚本。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM