Oracle SQL Developer 和 PostgreSQL

发布于 2024-12-07 09:59:50 字数 1990 浏览 1 评论 0原文

我正在尝试使用 Oracle SQL Developer 3.0.04 连接到 PostgreSQL 9.1 数据库,但到目前为止还没有取得任何成功。

首先,如果我在首选项中添加第三方驱动程序,则在添加新连接时,没有 PostgreSQL 选项卡(不过它对于 MySQL 来说工作得很好)。我使用的是 JDBC4 版本 9.1 驱动程序,但我尝试了相同版本的 JDBC3,但仍然得到相同的结果。

其次,添加新连接时没有什么比手动配置选项卡更好的了。最接近的是 Oracle 选项卡上的“高级”选项,我可以在其中提供自定义 URL,但它失败了,因为抱怨所选的驱动程序(当然)。

最后,我通过从 XML 文件导入连接(如下内容)进行连接,但它仅显示我的架构,而不显示其中的表。

所以,我的问题是:Orable SQL Developer 支持 PostgreSQL 连接吗?有没有其他方法可以让我的表格显示在 ObjectViewer 中?

<?xml version = '1.0' encoding = 'UTF-8'?>
<References xmlns="http://xmlns.oracle.com/adf/jndi">
    <Reference name="Lumea" className="oracle.jdeveloper.db.adapter.DatabaseProvider" credentialStoreKey="Lumea" xmlns="">
        <Factory className="oracle.jdeveloper.db.adapter.DatabaseProviderFactory"/>
        <RefAddresses>
            <StringRefAddr addrType="user">
                <Contents>lumea</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="subtype">
                <Contents>thirdParty</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="customUrl">
                <Contents>jdbc:postgresql://localhost:5432/versates</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="SavePassword">
                <Contents>true</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="password">
                <Contents>myencryptedpass</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="driver">
                <Contents>org.postgresql.Driver</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="DeployPassword">
                <Contents>true</Contents>
            </StringRefAddr>
        </RefAddresses>
    </Reference>
</References>

I'm trying to connect to a PostgreSQL 9.1 database using Oracle SQL Developer 3.0.04, but I'm not having any success so far.

First, if I add a third party driver on preferences, when adding a new connection there's no tab for PostgreSQL (it works fine for MySQL though). I'm using a JDBC4 version 9.1 driver, but I tried a JDBC3 of the same version and still get the same thing.

Second, there's nothing like manual configuration tab when adding a new connection. The closest is the Advanced option on Oracle tab, where I can provide a custom URL, but it fails because complains about the selected Driver (of course).

Finally, I got connected importing a connection from an XML file (contents below), but it displays only my schemas and doesn't show my tables inside them.

So, my question is: does Orable SQL Developer support PostgreSQL connections? Is there any other way to have my tables being displayed in the ObjectViewer?

<?xml version = '1.0' encoding = 'UTF-8'?>
<References xmlns="http://xmlns.oracle.com/adf/jndi">
    <Reference name="Lumea" className="oracle.jdeveloper.db.adapter.DatabaseProvider" credentialStoreKey="Lumea" xmlns="">
        <Factory className="oracle.jdeveloper.db.adapter.DatabaseProviderFactory"/>
        <RefAddresses>
            <StringRefAddr addrType="user">
                <Contents>lumea</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="subtype">
                <Contents>thirdParty</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="customUrl">
                <Contents>jdbc:postgresql://localhost:5432/versates</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="SavePassword">
                <Contents>true</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="password">
                <Contents>myencryptedpass</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="driver">
                <Contents>org.postgresql.Driver</Contents>
            </StringRefAddr>
            <StringRefAddr addrType="DeployPassword">
                <Contents>true</Contents>
            </StringRefAddr>
        </RefAddresses>
    </Reference>
</References>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

乱了心跳 2024-12-14 09:59:50

Oracle SQL Developer 4.0.1.14 确实支持与 PostgreSQL 的连接。

编辑

如果您有不同的用户名和数据库名称,应在主机名中指定:主机名/数据库?(不要忘记?)或主机名:端口/数据库?

(感谢@kinkajou和@Kloe2378231;更多详细信息请参见https://stackoverflow.com/a/28671213/565525) 。

Oracle SQL Developer 4.0.1.14 surely does support connections to PostgreSQL.

Edit:

If you have different user name and database name, one should specify in hostname: hostname/database? (do not forget ?) or hostname:port/database?.

(thanks to @kinkajou and @Kloe2378231; more details on https://stackoverflow.com/a/28671213/565525).

夜还是长夜 2024-12-14 09:59:50

我刚刚下载了适用于 OS X (10.9) 的 SQL Developer 4.0,它刚刚结束测试版。我还下载了最新的 Postgres JDBC jar。我一高兴就决定安装它(与 SQL Dev 中其他第三方数据库驱动程序的方法相同),并且它接受了它。每当我单击“新连接”时,现在都会有一个 Postgres 选项卡...单击它会显示一个询问数据库连接详细信息的面板。

这个问题的答案变了,不管支持与否,似乎都可以。有一个“选择数据库”按钮,如果单击该按钮,则会显示一个下拉列表,其中包含可用的 postgres 数据库。您创建连接并打开它,它会列出该数据库中的架构。大多数 postgres 命令似乎都可以工作,但没有 psql 命令(\list 等)。

那些需要一个工具来连接多个数据库引擎的人现在可以使用 SQL Developer。

I've just downloaded SQL Developer 4.0 for OS X (10.9), it just got out of beta. I also downloaded the latest Postgres JDBC jar. On a lark I decided to install it (same method as other third party db drivers in SQL Dev), and it accepted it. Whenever I click "new connection", there is a tab now for Postgres... and clicking it shows a panel that asks for the database connection details.

The answer to this question has changed, whether or not it is supported, it seems to work. There is a "choose database" button, that if clicked, gives you a dropdown list filled with available postgres databases. You create the connection, open it, and it lists the schemas in that database. Most postgres commands seem to work, though no psql commands (\list, etc).

Those who need a single tool to connect to multiple database engines can now use SQL Developer.

泪意 2024-12-14 09:59:50

Oracle SQL Developer 不支持与 PostgreSQL 的连接。使用 pgAdmin 来连接 PostgreSQL,您可以从以下 URL 获取它
http://www.pgadmin.org/download/windows.php

Oracle SQL Developer doesn't support connections to PostgreSQL. Use pgAdmin to connect to PostgreSQL instead, you can get it from the following URL
http://www.pgadmin.org/download/windows.php

薄荷港 2024-12-14 09:59:50

如果没有与用户名同名的数据库,则单击“选择数据库”将失败,并出现类似“状态:失败 -FATAL:数据库“your_username”不存在”的错误解决

方法将 5432/database_name? 放入 Port 字段中,其中 5432 是 Postgres 实例的端口, database_nameyour_username 有权访问的现有数据库的名称。然后再次单击“选择数据库”,它应该可以工作。现在您可以选择所需的数据库并从端口字段中删除额外的 /database_name?

If there is no database with the same name as the username, then clicking "Choose Database" will fail with an error like "Status : Failure -FATAL: database "your_username" does not exist"

To work around this, put 5432/database_name? in the Port field, where 5432 is the port of your Postgres instance and database_name is the name of at an existing database that your_username has access to. Then click "Choose Database" again and it should work. Now you can choose the database you want and remove the extra /database_name? from the Port field.

你的心境我的脸 2024-12-14 09:59:50

我设法使用 SQL Developer 连接到 postgres。
我下载了 postgres jdbc 驱动程序并将其保存在一个文件夹中。
我运行 SQL Developer ->工具->首选项->搜索->数据库连接
我为数据库和数据建模器定义了 postgres jdbc 驱动程序(可选)。

这就是窍门。
创建新连接时定义主机名,例如 localhost/crm?其中 crm 是数据库名称。测试连接,工作正常。

I managed to connect to postgres with SQL Developer.
I downloaded postgres jdbc driver and saved it in a folder.
I run SQL Developer -> Tools -> Preferences -> Search -> JDBC
I defined postgres jdbc driver for the Database and Data Modeler (optional).

This is the trick.
When creating new connection define Hostname like localhost/crm? where crm is the database name. Test the connection, works fine.

七度光 2024-12-14 09:59:50

我认为这个问题需要更新答案,因为自从最初提出这个问题以来,PostgreSQL 和 SQLDeveloper 都已经更新了好几次。

我有一个在 Azure 中运行的 PostgreSQL 实例,且 SSLMODE=Require。
虽然我一直在使用 DBeaverCE 访问该实例并生成 ER 图,但我已经非常熟悉 SQLDeveloper,它现在是 v19.4。

有关下载最新 PostgreSQL JDBC 驱动程序及其放置位置的说明是正确的。不过,改变的是配置数据库访问的位置。

您将找到一个文件 $HOME/.sqldeveloper/system19.4.0.354.1759/o.jdeveloper.db.connection.19.3.0.354.1759/connections.json

{
  "connections": [
    {
      "name": "connection-name-goes-here",
      "type": "jdbc",
      "info": {
        "customUrl": "jdbc:postgresql://your-postgresql-host:5432/DBNAME?sslmode=require",
        "hostname": "your-postgresql-host",
        "driver": "org.postgresql.Driver",
        "subtype": "SDPostgreSQL",
        "port": "5432",
        "SavePassword": "false",
        "RaptorConnectionType": "SDPostgreSQL",
        "user": "your_admin_user",
        "sslmode": "require"
      }
    }
  ]
}

您可以将此连接与以下两者一起使用Data Modeller 和 SQLDeveloper 的管理功能。需要在 customUrl 中指定所有端口、dbname 和 sslmode,因为 SQLDeveloper 不会在通过 JDBC 发送的内容中包含 sslmode,因此您必须手动构建它。

I think this question needs an updated answer, because both PostgreSQL and SQLDeveloper have been updated several times since it was originally asked.

I've got a PostgreSQL instance running in Azure, with SSLMODE=Require.
While I've been using DBeaverCE to access that instance and generate an ER Diagram, I've gotten really familiar with SQLDeveloper, which is now at v19.4.

The instructions about downloading the latest PostgreSQL JDBC driver and where to place it are correct. What has changed, though, is where to configure your DB access.

You'll find a file $HOME/.sqldeveloper/system19.4.0.354.1759/o.jdeveloper.db.connection.19.3.0.354.1759/connections.json:

{
  "connections": [
    {
      "name": "connection-name-goes-here",
      "type": "jdbc",
      "info": {
        "customUrl": "jdbc:postgresql://your-postgresql-host:5432/DBNAME?sslmode=require",
        "hostname": "your-postgresql-host",
        "driver": "org.postgresql.Driver",
        "subtype": "SDPostgreSQL",
        "port": "5432",
        "SavePassword": "false",
        "RaptorConnectionType": "SDPostgreSQL",
        "user": "your_admin_user",
        "sslmode": "require"
      }
    }
  ]
}

You can use this connection with both Data Modeller and the admin functionality of SQLDeveloper. Specifying all the port, dbname and sslmode in the customUrl are required because SQLDeveloper isn't including the sslmode in what it sends via JDBC, so you have to construct it by hand.

决绝 2024-12-14 09:59:50

我通过将用户名放入“用户名”字段(无密码)并单击“选择数据库”来获取要填充的数据库列表。不适用于空白的用户名字段,我只能通过这种方式连接到我的用户数据库。

(这是使用 SQL Developer 4.0.0.13、Postgres.app 9.3.0.0 和 postgresql-9.3-1100.jdbc41.jar,FWIW。)

I got the list of databases to populate by putting my username in the Username field (no password) and clicking "Choose Database". Doesn't work with a blank Username field, I can only connect to my user database that way.

(This was with SQL Developer 4.0.0.13, Postgres.app 9.3.0.0, and postgresql-9.3-1100.jdbc41.jar, FWIW.)

你如我软肋 2024-12-14 09:59:50

Oracle SQL Developer 2020-02 支持 PostgreSQL,但这只是基础知识,通过在 jdbc 目录下添加 postgreSQL 驱动程序并通过添加为第 3 方驱动程序进行配置。

支持的功能:

  • 可以在连接定义时选择多个数据库
  • CRUD 操作,例如查询表
  • 方案操作
  • 基本建模支持:显示没有 pk、fk、连接的表

不支持的功能:

  • 没有表或字段完成
  • 选项卡中不显示索引
  • 没有约束显示在选项卡中,如:fk、pk-s、unique 或其他
  • 编辑器中没有表或字段补全
  • 没有显示函数、包、触发器、视图

可悲的是 Oracle 应该只更改此视图后面的查询,以防万一PostgreSql 连接数。例如,对于索引,他们需要使用此查询: select * from pg_catalog.pg_indexes;

Oracle SQL Developer 2020-02 support PostgreSQL, but it is just the basics by adding postgreSQL driver under jdbc dir and configure by adding as a 3rd party driver.

The supported functionality:

  • multiple databases which can be selected at connection definition
  • CRUD operations like query tables
  • scheme operations
  • basic modelling support: show tables without pk, fk, connections

Not supported functionalities:

  • no table or field completion
  • no indexes are shown in a tab
  • no constraints are shown in a tab like: fk, pk-s, unique, or others
  • no table or field completions in the editor
  • no functions, packages,triggers, views are shown

The sad thing is Oracle should only change the queries behind this view in case of PostgreSql connections. For example for indexes they need to use this query: select * from pg_catalog.pg_indexes;

从﹋此江山别 2024-12-14 09:59:50

除非您的用户名和数据库名称不同,否则它将不起作用。听起来像是 SQLDeveloper 错误,但我找不到任何解决方法

也许 Oracle SQL Developer 连接到 postgresql 时存在一些错误。但是我成功地将 postgresql 与 navicat 连接起来。(我的 postgresql 用户名和数据库名称不同

Except that it will not work if your user name and database name are differents. It sounds like an SQLDeveloper bug and i can't find any workaroud

Maybe there are some bugs in Oracle SQL Developer when it connect to the postgresql.However I connect postgresql with navicat successfully.(My postgresql username and database name are different

七分※倦醒 2024-12-14 09:59:50

主机=本地主机/postgres?如果您需要架构/数据库使用,则为我工作:

localhost/postgres?currentSchema=myschema

ex: localhost/postgres?currentSchema=public

连接后,您还可以使用
[选择数据库]按钮并下拉

我们其他人的sql开发人员postgres jdbc url

host= localhost/postgres? worked for me if you need a schema/database use:

localhost/postgres?currentSchema=myschema

ex: localhost/postgres?currentSchema=public

once connected, you can also use the
[Choose Database] button and pull down

sql developer postgres jdbc url for the rest of us

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文