SQL Ant任务错误:找不到类:JDBC驱动程序com.microsoft.sqlserver.jdbc.SQLServerDriver无法加载 [英] SQL ANT TASK ERROR: Class Not Found: JDBC driver com.microsoft.sqlserver.jdbc.SQLServerDriver could not be loaded
问题描述
我想要运行使用ant任务的SQL查询,我使用的是SQLServerDriver(sqljdbc.jar)。这个jar文件位于我都运行应用程序需要我罐子
I want to run an SQL query using the ant tasks, and I am using the SQLServerDriver (sqljdbc.jar). This jar file is located where I have all of my jars needed to run the application
(的WebContent / WEB-INF / lib目录)
(WebContent/WEB-INF/lib)
这目录是我的类路径中,我在另一个任务命令定义它:
This directory is my classpath which I defined it in another TASK Command:
<!-- Define el classpath que es utilizado para compilar los archivos -->
<path id="classpath">
<fileset dir="${libs.dir}">
<include name="*.jar" />
</fileset>
</path>
这jar文件也在我的ecplise外部JAR文件表示。
我试图运行Ant命令如下:
This jar file is also indicated in my ecplise external jar files. The ant command that I am trying to run is the following:
<target name="db.query" description="Ejecuta un query de SQL">
<sql driver="${db.driverT}" url="${db.urlT}" userid="${db.userT}"
password="${db.passwordT}" print="TRUE">
SELECT * FROM T007_EDO;
</sql>
</target>
我应该怎么做来纠正我的错误?
What should I do to correct my error?
推荐答案
在这个问题的答案是简单地将行添加到我的db.query任务。
The answer to this question was to simply add the line to my db.query task.
classpathref =类路径
classpathref="classpath"
所以我在这里的jar文件所在的地方的类路径deffinition:
So I have my classpath deffinition of the place where the jar file is located in:
<path id="classpath">
<fileset dir="${libs.dir}">
<include name="*.jar" />
</fileset>
和我引用我的Ant任务:
And I reference that in my ant task:
<target name="db.query" description="Ejecuta un query de SQL">
<sql driver="${db.driverT}" url="${db.urlT}" userid="${db.userT}"
password="${db.passwordT}" print="TRUE" classpathref="classpath">
SELECT * FROM T007_EDO;
</sql>
这篇关于SQL Ant任务错误:找不到类:JDBC驱动程序com.microsoft.sqlserver.jdbc.SQLServerDriver无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!