如何在install4j for MySQL中配置执行SQL脚本?

时间:2021-10-16 01:14:00

I am trying to configure an Execute SQL Script from install4j in order to crate a database schema, but that Script/Item fails.

我试图从install4j配置一个执行SQL脚本,以便创建一个数据库模式,但该脚本/项失败。

Here are the current settings:

以下是当前设置:

  • JDBC Driver class name: DriverManager
  • JDBC驱动程序类名:DriverManager

  • JDBC URL: jdbc:mysql://localhost/
  • JDBC URL:jdbc:mysql:// localhost /

  • User: root
  • Password: password
  • SQL SCRIPT:

CREATE DATABASE IF NOT EXISTS videos;

创建数据库,如果不是视频;

GRANT USAGE ON . to videos_user@localhost IDENTIFIED BY '123password';

授予使用权。 to videos_user @ localhost IDENTIFIED BY'123password';

GRANT ALL PRIVILEGES ON videos.* TO videos_user@localhost;

在视频上授予所有特权。*至videos_user @ localhost;

FLUSH PRIVILEGES;

This at the moment is failing. I think the issue is that I need to add the JDBC driver JAR file. But I don't know where to get it and what class to add in the Driver class name.

目前这是失败的。我认为问题是我需要添加JDBC驱动程序JAR文件。但是我不知道从哪里获取它以及在Driver类名中添加什么类。

I know this migh be a "noob" questions, but I am really stuck at this point.

我知道这可能是一个“菜鸟”的问题,但我真的很困惑。

Thank you!

2 个解决方案

#1


Fixed it.

  • I downloaded the connector from http://dev.mysql.com/downloads/connector/j/
  • 我从http://dev.mysql.com/downloads/connector/j/下载了连接器

  • JDBC Driver class name should be com.mysql.jdbc.Driver
  • JDBC驱动程序类名应为com.mysql.jdbc.Driver

  • URL should be jdbc:mysql://localhost
  • URL应该是jdbc:mysql:// localhost

#2


Add the JDBC driver JAR on the "Installer->Custom Code & Resources" step.

在“Installer-> Custom Code&Resources”步骤中添加JDBC驱动程序JAR。

#1


Fixed it.

  • I downloaded the connector from http://dev.mysql.com/downloads/connector/j/
  • 我从http://dev.mysql.com/downloads/connector/j/下载了连接器

  • JDBC Driver class name should be com.mysql.jdbc.Driver
  • JDBC驱动程序类名应为com.mysql.jdbc.Driver

  • URL should be jdbc:mysql://localhost
  • URL应该是jdbc:mysql:// localhost

#2


Add the JDBC driver JAR on the "Installer->Custom Code & Resources" step.

在“Installer-> Custom Code&Resources”步骤中添加JDBC驱动程序JAR。