Reputation: 775
Trying the below code:
<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>
Getting the below error:
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
Please help.
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.
Upvotes: 0
Views: 10578
Reputation: 1
<sql
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:ENOVIADEV"
userid="sys"
password="enoviaV6"
expandProperties="true"
classpathref="antclasspath">
<connectionProperty name="internal_logon" value="SYSDBA"/>
<transaction>
create tablespace ${TablespaceName} datafile '${DatafilePath}/${DatafileNAME}' size 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
</transaction>
<transaction>
create user ${oracle.dbuser} identified by ${oracle.dbpassword} default tablespace ${TablespaceName} temporary tablespace TEMP;
</transaction>
<transaction>
grant connect, resource, unlimited tablespace to ${oracle.dbuser};
</transaction>
<transaction>
alter user ${Username} default role all;
</transaction>
</sql>
Upvotes: 0
Reputation: 31371
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>
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.
Upvotes: 6
Reputation: 11195
does the jar containing org.database.jdbcDriver
is in the classpath? you probably need to add a classpath attribute
<sql
classpath="mysql-connector-java-3.0.8-stable-bin.jar"
driver="org.database.jdbcDriver"
url="devtest"
userid="uid"
password="pass">
Upvotes: 1
Reputation: 842
You should specify class path to your driver
<sql classpathref="${classpath.id}" driver="" ...
And define your class path
<path id="classpath.id">
<fileset file="..." />
</path>
Upvotes: 1