代码之家  ›  专栏  ›  技术社区  ›  OHA

安装4J检查JDBC连接操作SetDriver

  •  1
  • OHA  · 技术社区  · 7 年前

    在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&resources”中,但仍然会出现相同的错误。

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

    下一步是什么?

    谢谢

    1 回复  |  直到 7 年前
        1
  •  0
  •   Ingo Kegel    7 年前

    驱动程序类名错误,应该是 org.postgresql.Driver .

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