title: JDBC Driver with PostgreSQL and Pentaho
body: <p><strong>Situation:</strong></p>
  
  <p>I'm using PostgreSQL 9.1 and now I'm using Pentaho Report Designer to create reports from a data warehouse stored on a database. This database is named <code>bd-datawarehouse</code>.</p>
  
  <p>The problem I have is when I try to create a connection from the Pentaho Report Designer to <code>bd-datawarehouse</code> database. I've configured all the settings and everything seems correct, like the next image:</p>
  
  <p><img src="https://i.stack.imgur.com/ZPQbj.png" alt="enter image description here"></p>
  
  <p><strong>but when I click the <code>Test</code> button, it gives me the next error:</strong></p>
  
  <pre><code>Error connecting to database [conexion-dw-reporting] : org.pentaho.di.core.exception.KettleDatabaseException: 
  Error occured while trying to connect to the database
  
  Exception while loading class
  org.postgresql.Driver
  
  
  org.pentaho.di.core.exception.KettleDatabaseException: 
  Error occured while trying to connect to the database
  
  Exception while loading class
  org.postgresql.Driver
  
  
      at org.pentaho.di.core.database.Database.normalConnect(Database.java:366)
      at org.pentaho.di.core.database.Database.connect(Database.java:315)
      at org.pentaho.di.core.database.Database.connect(Database.java:277)
      at org.pentaho.di.core.database.Database.connect(Database.java:267)
      at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:86)
      at org.pentaho.di.core.database.DatabaseMeta.testConnection(DatabaseMeta.java:2464)
      at org.pentaho.ui.database.event.DataHandler.testDatabaseConnection(DataHandler.java:533)
      at sun.reflect.GeneratedMethodAccessor133.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:329)
      at org.pentaho.ui.xul.swing.tags.SwingButton$OnClickRunnable.run(SwingButton.java:58)
      at java.awt.event.InvocationEvent.dispatch(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$200(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.WaitDispatchSupport$2.run(Unknown Source)
      at java.awt.WaitDispatchSupport$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.WaitDispatchSupport.enter(Unknown Source)
      at java.awt.Dialog.show(Unknown Source)
      at java.awt.Component.show(Unknown Source)
      at java.awt.Component.setVisible(Unknown Source)
      at java.awt.Window.setVisible(Unknown Source)
      at java.awt.Dialog.setVisible(Unknown Source)
      at org.pentaho.ui.xul.swing.tags.SwingDialog.show(SwingDialog.java:234)
      at org.pentaho.reporting.ui.datasources.jdbc.ui.XulDatabaseDialog.open(XulDatabaseDialog.java:256)
      at org.pentaho.reporting.ui.datasources.jdbc.ui.ConnectionPanel$EditDataSourceAction.actionPerformed(ConnectionPanel.java:159)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
      at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
      at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$200(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.WaitDispatchSupport$2.run(Unknown Source)
      at java.awt.WaitDispatchSupport$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.WaitDispatchSupport.enter(Unknown Source)
      at java.awt.Dialog.show(Unknown Source)
      at java.awt.Component.show(Unknown Source)
      at java.awt.Component.setVisible(Unknown Source)
      at java.awt.Window.setVisible(Unknown Source)
      at java.awt.Dialog.setVisible(Unknown Source)
      at org.pentaho.reporting.libraries.designtime.swing.CommonDialog.performEdit(CommonDialog.java:156)
      at org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.performConfiguration(JdbcDataSourceDialog.java:759)
      at org.pentaho.reporting.ui.datasources.jdbc.JdbcDataSourcePlugin.performEdit(JdbcDataSourcePlugin.java:67)
      at org.pentaho.reporting.designer.core.actions.elements.EditDataSourceAction.performEdit(EditDataSourceAction.java:139)
      at org.pentaho.reporting.designer.core.actions.elements.EditDataSourceAction.actionPerformed(EditDataSourceAction.java:109)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.AbstractButton.doClick(Unknown Source)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$200(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)
  Caused by: org.pentaho.di.core.exception.KettleDatabaseException: 
  Exception while loading class
  org.postgresql.Driver
  
      at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:421)
      at org.pentaho.di.core.database.Database.normalConnect(Database.java:350)
      ... 121 more
  Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:412)
      ... 122 more
  
  Hostname       : localhost
  Port           : 5432
  Database name  : bd-datawarehouse
  </code></pre>
  
  <p>You must know that all fields of settings are right (database name, port number, host name, user name and password). </p>
  
  <p>Seeing the error, I've thought that the problem could be that I haven't the jdbc driver to connect a PostgreSQL database, so I've looked for it and I've done like the accepted answer of <a href="https://stackoverflow.com/questions/9537273/adding-a-jdbc-driver-to-pentaho-design-studio-and-configuring-the-datasource">this question</a> said: I've downloaded the driver for my postgresql 9.2 from <a href="http://jdbc.postgresql.org/download.html#supported" rel="nofollow noreferrer">here</a> and I've put it on <code>...\biserver-ce\tomcat\lib\</code>, but the problem persists.</p>
  
  <p>I don't know how to solve it, because I don't understand so deeply which is the problem.</p>
  
  <p>Any help would be appreciated!</p>