Inno Setup中的MySQL查询 [英] MySQL query in Inno Setup

查看:199
本文介绍了Inno Setup中的MySQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在了解 Inno Setup 之前,已使用

Before knowing about Inno Setup used IzPack to do my installer, due to the need to verify if the port of the service that was about to create was in use, towards a query to the database with the driver jdbc, so if the connection was valid then send a error message to change the port.

这就是我以前做过的方式,但是我不知道如何在Inno Setup中做到这一点:

So this is the way I did before, but I do not know how to do it in Inno Setup:

try {
    Class.forName("com.mysql.jdbc.Driver");

    Connection conn =
        DriverManager.getConnection(
            "jdbc:mysql://" + server + ":" + port + "/database", "root", password);

    if (conn.isValid(0)) {
        error = "A server-type installation already exists in: " + server;
        return Status.ERROR;
    }
} catch (ClassNotFoundException ex) {
    Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
    Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
}

非常感谢您.

推荐答案

您将必须执行命令行MySQL客户端(mysql).

You will have to execute a command-line MySQL client (mysql).

有关执行可执行文件,检查其退出代码和/或检查其输出的一些示例,请参阅:

For some examples of executing an executable and checking its exit code and/or inspecting its output, see:

  • Using Process Exit code to show error message for a specific File in [Run];
  • How to get an output of an Exec'ed program in Inno Setup?

这篇关于Inno Setup中的MySQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆