Install4j检查JDBC连接操作SetDriver

时间:2018-01-19 10:40:08

标签: install4j

在Install4j中,我调用CheckJdbcConnectionAction操作并执行它。 但它不起作用。
这是代码:

    CheckJdbcConnectionAction checkConnection = new CheckJdbcConnectionAction();
    checkConnection.setDriverClassName("org.postgres.Driver");

这是日志:

    [ERROR] com.install4j.runtime.beans.actions.jdbc.CheckJdbcConnectionAction: Driver class org.postgres.Driver was not found. Add the JAR file to the "Installer->Custom code & resources" step.

我将jar(postgresql-42.2.0.jre7.jar)添加到" Installer-> Custom code&资源"但它仍然给我同样的错误。

我将setDriverClassName的值更改为postgresql-42.2.0.jre7,但仍然是同样的错误

下一步是什么让它发挥作用?

感谢

1 个答案:

答案 0 :(得分:0)

驱动程序类名称错误,应为org.postgresql.Driver

此外,如果您确实想以编程方式执行此操作,则还必须设置属性setJdbcUrl(...)setUser(...)setPassword(...)