0

I am developing my first web app in Ofbiz framework with psql database. I added the postgresql-8.1-404.jdbc2.jar jdbc driver jar to /framework/entity/lib/jdbc folder and made necessary corrections to entityengine.xml file and now trying to access the table in the database with the following groovy code.

@GrabConfig(systemClassLoader = true)

import groovy.sql.Sql

Class.forName("org.postgresql.Driver");
def dbUrl      = "jdbc:postgresql://127.0.0.1:5432/dbname"
def dbUser     = "postgres"
def dbPassword = "root"
def dbDriver   = "org.postgresql.Driver"

def sql = Sql.newInstance(dbUrl, dbUser, dbPassword, dbDriver)
// even Groovier...
sql.eachRow('SELECT * FROM tablename') {
  println  it.party_id }

but it throws the following exception

[java] Exception: java.sql.SQLException
[java] Message: No suitable driver found for jdbc:postgresql://127.0.0.1:5432/dbname

help to resolve my problem...Thank You.

user3256546
  • 73
  • 2
  • 5

0 Answers0