【问题标题】:How to run a SQL script in Jenkins by invoking ANT?如何通过调用 ANT 在 Jenkins 中运行 SQL 脚本?
【发布时间】:2015-02-10 22:52:56
【问题描述】:

我正在尝试使用 Jenkins 来执行我的源代码控制中的 SQL 脚本。为此,我创建了一个构建任务来调用 ANT。我的 ANT 版本是 1.9.4。

这是我正在调用的构建文件

<project name="VResources-Reset">
<sql
    driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    url="jdbc:sqlserver://SERVER_NAME:1433;databaseName=Automation"
    userid="USERID"
    password="PWD"      
    src="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\Database\\Viewpoint\\View Resources\\VResources - Reset Users.sql"/>
<classpath>
    <pathelement location="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\libs\\sqljdbc4.jar"/>
</classpath>
</project>

我也尝试过使用org.database.jdbcDriver 作为驱动程序。

当我尝试在 Jenkins 中构建我的项目时,我总是收到以下错误并且无法弄清楚原因。 ANT 和 Jenkins 对我来说很陌生,所以我确定我缺少一些简单的东西。有人能指出那是什么吗?

Class Not Found: JDBC driver com.microsoft.sqlserver.jdbc.SQLServerDriver could not be loaded

【问题讨论】:

标签: jdbc ant jenkins


【解决方案1】:

希望 classPath 应该在 sql 元素中传递。 请试试这个..

<project name="VResources-Reset">
<sql driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://SERVER_NAME:1433;databaseName=Automation"
    userid="USERID"
    password="PWD"      
    src="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\Database\\Viewpoint\\View Resources\\VResources - Reset Users.sql">
<classpath>
    <pathelement location="C:\\SvyDeploy\\DEV\\Sprint\\Automation\\libs\\sqljdbc4.jar"/>
</classpath>
</sql>
</project>

【讨论】:

    猜你喜欢
    • 2012-03-23
    • 1970-01-01
    • 1970-01-01
    • 2022-07-21
    • 1970-01-01
    • 2018-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多