ANT:Jdbc 驱动程序错误 [英] ANT: Jdbc driver error
本文介绍了ANT:Jdbc 驱动程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试以下代码:
<sql
classpath="postgresql-8.4-701.jdbc3.jar"
driver="org.database.jdbcDriver"
url="devtest"
userid="uid"
password="pass">
select * from tab where tname = 'GR_DOCUMENT_PRINT_DFV';
</sql>
出现以下错误:
BUILD FAILED
C:\Program Files\Java\apache-ant-1.8.1\build.xml:62: Class Not Found: JDBC driver
org.database.jdbcDriver could not be loaded
Total time: 1 second
请帮忙.
现在我已经更新了代码.将类路径添加到之前的代码中.还要将 mysql-connector-java-3.0.8-stable-bin.jar 和 postgresql-8.4-701.jdbc3.jar 文件添加到 ANT_HOME/lib 但仍然得到相同的错误.
Now I have updated the code. Add classpath to the previous code. Also add mysql-connector-java-3.0.8-stable-bin.jar and postgresql-8.4-701.jdbc3.jar file to ANT_HOME/lib but still getting the same error.
推荐答案
如果你在用Oracle,可以试试吗
If you're using Oracle, can you try
<path id="antclasspath">
<fileset dir="path-to-lib">
<include name="ojdbc14.jar"/>
</fileset>
</path>
<sql
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@serverip:1521:sid"
userid="userid"
password="password"
print="yes"
classpathref="antclasspath">
select * from tab where tname = 'GR_DOCUMENT_PRINT_DFV';
</sql>
如果您仍然遇到相同的错误,请使用 -v 开关运行 ant.这将指示 sql 任务打印出它正在使用的类路径,您可以验证.
If you still have the same error, run ant with the -v switch. That will direct the sql task to print out the classpath it's using and you can verify.
这篇关于ANT:Jdbc 驱动程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文