How to use oracle extensions?

Hi,

I need to add oracle support in liquibase, but I’ve never used it before, so I have problems.
It says: To use, simply include the oracle-extentions.jar file in your classpath.
I did it in liquibase:properties
“classpath: …/ojdbc14.jar;…/liquibase-extensions-1.0.jar”
but when trying <ora:createTrigger … > I get this:
"Migration Failed: cvc-complex-type.2.4.a: Invalid content was found starting wit
h element ‘ora:createTrigger’. One of '{“http://www.liquibase.org/xml/ns/dbchangelog…”

It would be helpful to show me a full example of cmd line,properties file, and update.xml how to use it (in general a full simple example, which works), because I think there can be problem with e.g. xml schema or other stuff (it’s not clear what is required and what not) , but I didnt found information how to use it.

Thanx

You do need to be using liquibase 2.0, and make sure that the xsd you are using a root node with the 2.0 xsd like this:

<databaseChangeLog
        xmlns=“http://www.liquibase.org/xml/ns/dbchangelog”
        xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd>

Does that help?

Thanks, I used this with liquibase 2.0 and it works. Needed to add xmlns:ora yet.

<databaseChangeLog xmlns=“http://www.liquibase.org/xml/ns/dbchangelog”
                  xmlns:ora=“http://www.liquibase.org/xml/ns/dbchangelog-ext”
                  xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
                  xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd”>

I have another problem, when trying:

   
        <ora:createTrigger
        afterBeforeInsteadOf=“before”
        procedure=“begin select departments_seq.nextval into :new.id from dual; end;” 
        triggerName=“departments_trg”
        tableName=“departments”
        insert=“true”
        forEachRow=“true”
        />     
     

I get:
LiquiBase Update Failed: Validation Failed:
    1 changes have validation errors
          java.lang.NoSuchMethodError: liquibase.exception.ValidationErrors.chec
kDisallowedField(Ljava/lang/String;Ljava/lang/Object;)V
.  For more information, use the --logLevel flag)
SEVERE 9.4.2010 14:10:liquibase: Validation Failed:
    1 changes have validation errors
          java.lang.NoSuchMethodError: liquibase.exception.ValidationErrors.chec
kDisallowedField(Ljava/lang/String;Ljava/lang/Object;)V

liquibase.exception.ValidationFailedException: Validation Failed:
    1 changes have validation errors
          java.lang.NoSuchMethodError: liquibase.exception.ValidationErrors.chec
kDisallowedField(Ljava/lang/String;Ljava/lang/Object;)V

        at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java
:131)
        at liquibase.Liquibase.update(Liquibase.java:97)
        at liquibase.integration.commandline.Main.doMigration(Main.java:664)
        at liquibase.integration.commandline.Main.main(Main.java:105)

We have made a few changes leading up to 2.0 that have apparently broken the extension.  I’ll take a look at the extension code and get it fixed up.

Nathan

What was the Liquibase version, the Oracle Extensions 0.1 were originally made for?

It was an early build of 2.0.  I’m not sure exactly when it was from.  There hasn’t been a lot of changes in the liquibase API since then, but there has been a couple.  Part of what is holding up the 2.0 release is me ensuring that the final version of the APIs will not need to change cause issues like this in the future.

Nathan

Hi…

I’m using this amazing project (liquibase) but I have a problem with the oracle extension. It’s seen like the jar is not in sync with the latest version of liquibase.

So my question is? When is going to be released the new version of oracle extension? or there is a new version and I didn’t found it.

Please let me know.

Best regards

Alejandro

It hasn’t been synced up yet.  It’s on my to-do list for this week hopefully. 

Nathan

Does RC7 support oracle extensions?

Is there something I should do differently?

This code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<databaseChangeLog xmlns=“http://www.liquibase.org/xml/ns/dbchangelog”
    xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
    xmlns:ora=“http://www.liuitbase.org/xml/ns/dbchangelog-ext”
    xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd”>

 

Results in error output:

INFO: Successfully released change log lock
Nov 9, 2010 8:53:14 PM liquibase.logging.jvm.JavaUtilLogger info
INFO: liquibase.ext.ora.droptrigger.DropTriggerOracle.warn(Lliquibase/statement/SqlStatement;Lliquibase/database/Database;Lliquibase/sqlgenerator/SqlGeneratorChain;)Lliquibase/exception/Warnings;
java.lang.AbstractMethodError: liquibase.ext.ora.droptrigger.DropTriggerOracle.warn(Lliquibase/statement/SqlStatement;Lliquibase/database/Database;Lliquibase/sqlgenerator/SqlGeneratorChain;)Lliquibase/exception/Warnings;
at liquibase.sqlgenerator.SqlGeneratorChain.warn(SqlGeneratorChain.java:38)
at liquibase.sqlgenerator.SqlGeneratorFactory.warn(SqlGeneratorFactory.java:165)
at liquibase.change.AbstractChange.warn(AbstractChange.java:80)
at liquibase.changelog.visitor.ValidatingVisitor.visit(ValidatingVisitor.java:77)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:128)
at liquibase.Liquibase.update(Liquibase.java:109)
at liquibase.integration.commandline.Main.doMigration(Main.java:685)
at liquibase.integration.commandline.Main.main(Main.java:115)

There is a new build on liquibase.org/extensions site that should work with the newest core liquibase RC7 now. Let me know if you run into troubles with it.

Nathan