Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
dbdeploy & classpath
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sprytel  
View profile  
 More options Feb 4 2008, 3:21 pm
From: sprytel <dwe...@gmail.com>
Date: Mon, 4 Feb 2008 12:21:53 -0800 (PST)
Local: Mon, Feb 4 2008 3:21 pm
Subject: dbdeploy & classpath
I am using the Ant task for dbdeploy.  Am I correct in assuming that
the database driver has to be included in the classpath that launches
Ant (eg.  "ant -cp oracle.jar  dbinit") ?

If that is the case, then I have a patch for dbdeploy that lets it
take a <classpath> element (just like <sql> task does) that I would
like to contribute, if anybody else is interested.

On the other hand, if dbdeploy already supports this, or if there was
an easier way to do this, can somebody tell me what the better way to
do this is?

Cheers,
-Tim.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Janek Bogucki  
View profile  
 More options Feb 5 2008, 5:14 am
From: "Janek Bogucki" <jane...@gmail.com>
Date: Tue, 5 Feb 2008 10:14:45 +0000
Local: Tues, Feb 5 2008 5:14 am
Subject: Re: dbdeploy & classpath
Hi,

This is how I am using dbdeploy. It is easier than patching dbdeploy.

  <property name="mysql-connector.jar"
location="${lib}/mysql/mysql-connector-java-5.0.8-bin.jar"/>

  <taskdef name="dbdeploy" classname="net.sf.dbdeploy.AntTarget"
classpath="${dbdeploy.dir}/lib/dbdeploy.jar:${mysql-connector.jar}"/>

  <macrodef name="exec_sql">
    <attribute name="src"/>
    <attribute name="user"/>
    <attribute name="password"/>
    <attribute name="onerror"/>
    <attribute name="delimitertype"/>
    <sequential>
      <sql
        classpath="${mysql-connector.jar}"
        driver="${db.driver}"
        url="${db.url}"
        userid="@{user}"
        password="@{password}"
        src="@{src}"
        onerror="@{onerror}"
        delimitertype="@{delimitertype}"
      />
    </sequential>
  </macrodef>

  <target name="dbd-generate-delta-script" description="uses dbdeploy
to generate the update and undo scripts" depends="db-selected">
        <property name="out" value="${basedir}/db-deltas-${db.name}.sql"/>
        <property name="out-undo" value="${basedir}/db-deltas-${db.name}-UNDO.sql"/>
    <dbdeploy
        driver="${db.driver}"
        url="${db.url}"
        userid="${db.dba.username}"
        password="${db.dba.password}"

        dir="${basedir}/db-deltas"
        outputfile="${out}"
        dbms="mysql"
        undoOutputfile="${out-undo}"
    />
        <!-- To allow delimitertype="row" to work in the sql task it is
necessary to move ;'s onto their own line, and to replace \g with ;
-->
        <replace_terminators file="${out}"/>
        <replace_terminators file="${out-undo}"/>
  </target>

All the best,
-Janek

On 04/02/2008, sprytel <dwe...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sprytel  
View profile  
 More options Feb 5 2008, 10:13 am
From: sprytel <dwe...@gmail.com>
Date: Tue, 5 Feb 2008 07:13:56 -0800 (PST)
Local: Tues, Feb 5 2008 10:13 am
Subject: Re: dbdeploy & classpath
Hrmm...

I created a build file based off what you posted above... with the
biggest difference being the use of an Oracle db driver instead of
Mysql.  When I execute, I get the following:

C:\applic>ant -f db-build.xml
Buildfile: db-build.xml

dbd-generate-delta-script:
 [dbdeploy] Reading change scripts from directory C:\applic\db
\migration...
 [dbdeploy] dbdeploy v2.11

BUILD FAILED
C:\applic\db-build.xml:43: C:\applic\db-build.xml:43: Class Not Found:
JDBC driv
er oracle.jdbc.OracleDriver could not be loaded

Total time: 0 seconds

C:\applic>ant -cp lib/oracle-10.2.0.1.jar -f db-build.xml
Buildfile: db-build.xml

dbd-generate-delta-script:
 [dbdeploy] Reading change scripts from directory C:\applic\db
\migration...
 [dbdeploy] dbdeploy v2.11
 [dbdeploy] Changes currently applied to database:
 [dbdeploy]   1..11
 [dbdeploy] Scripts available:
 [dbdeploy]   1..11
 [dbdeploy] To be applied:
 [dbdeploy]   (none)

BUILD SUCCESSFUL
Total time: 1 second

As you can see, it doesn't seem to be able to find that Oracle driver
unless I add it to the classpath when starting Ant.

I have noticed this same thing in the "dbdeploy-demo" examples as
well-- that they explicitly specify the library in a build batch
file.  For instance:

ant -buildfile build-hsql.xml apply-deltas -lib .\lib\dbdeploy.jar -
lib .\lib\hsqldb.jar

So, I guess I'm confused.  Does your Ant build really work without
specifying the driver?  Or are you passing them in-- either directly,
or indirectly via a batch file or some such?

I appreciate the help. Thanks!
-Tim,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Janek Bogucki  
View profile  
 More options Feb 5 2008, 1:04 pm
From: "Janek Bogucki" <jane...@gmail.com>
Date: Tue, 5 Feb 2008 18:04:11 +0000
Local: Tues, Feb 5 2008 1:04 pm
Subject: Re: dbdeploy & classpath
Hi,

My ant build does work without specifying a -cp option to ant. I run this

  ant use-main dbd-apply-deltas

I do however specify the driver class:

 <target name="dbd-generate-delta-script" description="uses dbdeploy
to generate the update and undo scripts" depends="db-selected">
       <property name="out" value="${basedir}/db-deltas-${db.name}.sql"/>
       <property name="out-undo"
value="${basedir}/db-deltas-${db.name}-UNDO.sql"/>
   <dbdeploy
       driver="${db.driver}"
       url="${db.url}"
       userid="${db.dba.username}"
       password="${db.dba.password}"

       dir="${basedir}/db-deltas"
       outputfile="${out}"
       dbms="mysql"
       undoOutputfile="${out-undo}"
   />
       <!-- To allow delimitertype="row" to work in the sql task it is
necessary to move ;'s onto their own line, and to replace \g with ;
-->
       <replace_terminators file="${out}"/>
       <replace_terminators file="${out-undo}"/>
 </target>

I also specify the MySQL driver jar in the macrodef

 <macrodef name="exec_sql">
   <attribute name="src"/>
   <attribute name="user"/>
   <attribute name="password"/>
   <attribute name="onerror"/>
   <attribute name="delimitertype"/>
   <sequential>
     <sql
       classpath="${mysql-connector.jar}"
       driver="${db.driver}"
       url="${db.url}"
       userid="@{user}"
       password="@{password}"
       src="@{src}"
       onerror="@{onerror}"
       delimitertype="@{delimitertype}"
     />
   </sequential>
 </macrodef>

All the best,
-Janek

On 05/02/2008, sprytel <dwe...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »