I am getting a "no suitable driver" error message using hibernate tools 3.2 beta 8 in ANT standalone (no eclipse). I'm using Oracle 10g and I've double checked the driver class and connection string. It is clear that the driver class is being found b/c when I change it to something wrong I get an error that the class cannot be found. Somehow the driver is not found for the URL via the DriverManager however.
I'm stumped by this error; here is the ANT file:
Code:
<project name="core">
<!-- hibernate tool properties -->
<property name="jdbc.driver.jar" value="C:/eng/projects/core/lib/ojdbc14.jar" />
<property name="hibernate.jar"
value="P:/Engineering/thirdparty/hibernate/hibernate-3.2/hibernate3.jar" />
<property name="hibernate.tools.lib"
value="P:/Engineering/thirdparty/hibernate/HibernateTools-3.2.0.beta8/plugins/org.hibernate.eclipse_3.2.0.beta8/lib/tools" />
<!-- End hibernate tool properties -->
<!-- hibernate tool configuration -->
<path id="toolslib">
<pathelement location="${hibernate.tools.lib}/hibernate-tools.jar" />
<pathelement location="${hibernate3.jar}" />
<pathelement location="${hibernate.tools.lib}/freemarker.jar" />
<pathelement location="${jdbc.driver.jar}" />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />
<!-- End hibernate tool configuration -->
<!-- project configuration -->
<property name="target.dir" value="${basedir}/generated" />
<path id="hibernate.classpath">
<pathelement location="${basedir}/classes/production/Control" />
</path>
<target name="generate-schema">
<mkdir dir="${target.dir}/sql" />
<hibernatetool destdir="${target.dir}">
<configuration configurationfile="${basedir}/hibernate-tool.cfg.xml">
<fileset dir="${basedir}/Control/src" includes="**/*.hbm.xml" />
</configuration>
<classpath refid="hibernate.classpath" />
<!-- hbm2ddl export="false" format="true"
outputfilename="sql/schema.sql" / -->
<hbm2ddl export="false" format="true" update="true"
outputfilename="sql/diff.sql" />
</hibernatetool>
</target>
</project>
and the configuration file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@obi-wan:1521:dev10g</property>
<property name="connection.username">sc</property>
<property name="connection.password">sc</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>
finally the result:
Code:
[13:50 C:/eng/projects/ServeCentral] ant generate-schema
Buildfile: build.xml
generate-schema:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.0
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate-tool.cfg.xml
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.Configuration addFile
[hibernatetool] INFO: Reading mappings from file: C:\eng\projects\ServeCentral\Control\src\com\servecentral\model\Address.hbm.xml
[hibernatetool] Nov 20, 2006 1:57:54 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: com.servecentral.model.Address -> ADDRESS
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.Configuration addFile
[hibernatetool] INFO: Reading mappings from file: C:\eng\projects\ServeCentral\Control\src\com\servecentral\model\Serve.hbm.xml
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: com.servecentral.model.Serve -> SERVE
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.Configuration addFile
[hibernatetool] INFO: Reading mappings from file: C:\eng\projects\ServeCentral\Control\src\com\servecentral\model\Target.hbm.xml
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: com.servecentral.model.Target -> TARGET
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.Configuration addFile
[hibernatetool] INFO: Reading mappings from file: C:\eng\projects\ServeCentral\Control\src\com\servecentral\model\User.hbm.xml
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: com.servecentral.model.User -> User
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.HbmBinder bindUnionSubclass
[hibernatetool] INFO: Mapping union-subclass: com.servecentral.model.Client -> CLIENT
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.cfg.HbmBinder bindUnionSubclass
[hibernatetool] INFO: Mapping union-subclass: com.servecentral.model.ProcessServer -> PROCESS_SERVER
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.Oracle9Dialect
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
[hibernatetool] INFO: Running hbm2ddl schema update
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
[hibernatetool] INFO: fetching database metadata
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@obi-wan:1521:dev10g
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=sc, password=****}
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
[hibernatetool] SEVERE: could not get database metadata
[hibernatetool] java.sql.SQLException: No suitable driver
[hibernatetool] at java.sql.DriverManager.getConnection(DriverManager.java:545)
[hibernatetool] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[hibernatetool] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[hibernatetool] at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
[hibernatetool] at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:42)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:401)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:338)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[hibernatetool] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[hibernatetool] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
[hibernatetool] Nov 20, 2006 1:57:55 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
[hibernatetool] SEVERE: could not complete schema update
[hibernatetool] java.sql.SQLException: No suitable driver
[hibernatetool] at java.sql.DriverManager.getConnection(DriverManager.java:545)
[hibernatetool] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[hibernatetool] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[hibernatetool] at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
[hibernatetool] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
[hibernatetool] at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:42)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:401)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:338)
[hibernatetool] at org.apache.tools.ant.Target.performTasks(Target.java:365)
[hibernatetool] at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
[hibernatetool] at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
[hibernatetool] at org.apache.tools.ant.Main.runBuild(Main.java:669)
[hibernatetool] at org.apache.tools.ant.Main.startAnt(Main.java:220)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
[hibernatetool] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
I'd appreciate any help.