简体   繁体   English

Pentaho与PostgreSQL的连接

[英]Connection in Pentaho with PostgreSQL

I have the driver postgresql-9.3-1103.jdbc3.jar in folder ...data-integration\\lib and classpah is configured too 我在文件夹... data-integration \\ lib中有驱动程序postgresql-9.3-1103.jdbc3.jar并且也配置了classpah

I have the postgresql 9.3 Installed and i have the db prueba in postgresql but this is the error 我已经安装了PostgreSQL 9.3,并且在PostgreSQL中有db prueba,但这是错误

Error connecting to database [PostgresDB] : org.pentaho.di.core.exception.KettleDatabaseException: 
Error occurred while trying to connect to the database

Error connecting to database: (using class org.postgresql.Driver)
Invalid connection URL url jdbc:postgresql://localhost:5432/prueba

org.pentaho.di.core.exception.KettleDatabaseException: 
Error occurred while trying to connect to the database

Error connecting to database: (using class org.postgresql.Driver)
Invalid connection URL url jdbc:postgresql://localhost:5432/prueba

at org.pentaho.di.core.database.Database.normalConnect(Database.java:428)
at org.pentaho.di.core.database.Database.connect(Database.java:358)
at org.pentaho.di.core.database.Database.connect(Database.java:311)
at org.pentaho.di.core.database.Database.connect(Database.java:301)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:80)
at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2686)
at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:546)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.ui.xul.impl.AbstractXulDomContainer.invoke(AbstractXulDomContainer.java:313)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:157)
at org.pentaho.ui.xul.impl.AbstractXulComponent.invoke(AbstractXulComponent.java:141)
at org.pentaho.ui.xul.swt.tags.SwtButton.access$500(SwtButton.java:43)
at org.pentaho.ui.xul.swt.tags.SwtButton$4.widgetSelected(SwtButton.java:138)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:389)
at org.pentaho.ui.xul.swt.tags.SwtDialog.show(SwtDialog.java:318)
at org.pentaho.di.ui.core.database.dialog.XulDatabaseDialog.open(XulDatabaseDialog.java:116)
at org.pentaho.di.ui.core.database.dialog.DatabaseDialog.open(DatabaseDialog.java:59)
at org.pentaho.di.ui.spoon.delegates.SpoonDBDelegate.editConnection(SpoonDBDelegate.java:87)
at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3084)
at org.pentaho.di.ui.spoon.Spoon.doubleClickedInTree(Spoon.java:3019)
at org.pentaho.di.ui.spoon.Spoon.access$2400(Spoon.java:345)
at org.pentaho.di.ui.spoon.Spoon$27.widgetDefaultSelected(Spoon.java:6113)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:1319)
at org.pentaho.di.ui.spoon.Spoon.waitForDispose(Spoon.java:7939)
at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9190)
at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:654)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)

Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
Error connecting to database: (using class org.postgresql.Driver)
Invalid connection URL url jdbc:postgresql://localhost:5432/prueba

at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:594)
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:4697)
at org.pentaho.di.core.database.Database.normalConnect(Database.java:414)
... 45 more

Caused by: java.lang.IllegalArgumentException: Invalid connection URL url jdbc:postgresql://localhost:5432/prueba
at org.mariadb.jdbc.JDBCUrl.parse(JDBCUrl.java:144)
at org.mariadb.jdbc.Driver.connect(Driver.java:95)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:574)
... 47 more

Hostname : localhost Port : 5432 Database name : prueba 主机名:本地主机端口:5432数据库名称:prueba

In JDBC, the DriverManager will query all registered drivers to see if they can use the URL to connect. 在JDBC中, DriverManager将查询所有已注册的驱动程序,以查看它们是否可以使用URL进行连接。 If a driver doesn't support the provided URL (eg because the driver queried is for Firebird, and the URL is for PostgreSQL), the Driver.connect implementation should return null: 如果驱动程序不支持提供的URL(例如,因为查询的驱动程序用于Firebird,而URL用于PostgreSQL),则Driver.connect实现应返回null:

The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. 如果驱动程序意识到连接到给定URL的驱动程序类型错误,则应返回“ null”。 This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn. 这是很常见的,因为当要求JDBC驱动程序管理器连接到给定的URL时,它将URL依次传递给每个已加载的驱动程序。

Long story short, if you look at the stacktrace you will see at the bottom: 长话短说,如果您查看stacktrace,您将在底部看到:

Caused by: java.lang.IllegalArgumentException: Invalid connection URL url jdbc:postgresql://localhost:5432/prueba
at org.mariadb.jdbc.JDBCUrl.parse(JDBCUrl.java:144)
at org.mariadb.jdbc.Driver.connect(Driver.java:95)
at java.sql.DriverManager.getConnection(Unknown Source)

In other words, the org.mariadb.jdbc.Driver is misbehaving and throwing a java.lang.IllegalArgumentException instead of returning null as it should. 换句话说, org.mariadb.jdbc.Driver行为不当并抛出java.lang.IllegalArgumentException而不是应该返回null This causes the DriverManager to stop trying other drivers, and as a result it never even tries to use the PostgreSQL driver. 这将导致DriverManager停止尝试其他驱动程序,结果甚至从未尝试使用PostgreSQL驱动程序。

Possible solutions or workarounds are: 可能的解决方案或解决方法是:

  • Remove the MariaDB driver from the classpath of Pentaho 从Pentaho的类路径中删除MariaDB驱动程序
  • Check if there is a newer version of the MariaDB driver that has this bug fixed 检查是否有较新版本的MariaDB驱动程序已修复此错误
  • Check if there is an older version of the MariaDB driver that doesn't have this bug 检查是否有较旧版本的MariaDB驱动程序没有此错误

A quick search shows this is bug CONJ-167 which should be fixed in the MariaDB Connector/J 1.2.2, which hasn't been released yet. 快速搜索显示此错误为CONJ-167 ,应在尚未发布的MariaDB Connector / J 1.2.2中修复。

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

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