Groovy & Postgresql

Hello,

I’ve got this error in my groovy script :

unable to resolve class org.postgresql.Driver

import groovy.sql.Sql;
import java.sql.Driver;

Sql sql = BonitaSql.newInstance(“jdbc:postgresql://localhost:5432/postgres”,“postgres”, “admin”, new org.postgresql.Driver());

Thanks for your help.

Have you copied the postgresql JAR to the lib directory, if so have you restarted the server/studio?

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Note that it’s usually recommended to use the data source connector to access database as you can benefit from connection pooling feature that lead to better performances.

I don’t know if this is your use case, but note that it’s not recommended to directly query Bonita Engine database but rather use the APIs. APIs are stable between each version of Bonita whereas the database schema might change.

Hi,

After a copy of postgresql JAR to the lib directory, all is fine.

Thanks a lot for the answer but also for the comment (to better performances).

Patrick.