# \[LB2-b3\] changelog file with condition and sequence definition on MySQL

**URL:** <https://forum.liquibase.org/t/lb2-b3-changelog-file-with-condition-and-sequence-definition-on-mysql/250>\
**Category:** General Discussion\
**Created:** [September 21, 2009, 7:39am UTC](https://forum.liquibase.org/t/lb2-b3-changelog-file-with-condition-and-sequence-definition-on-mysql/250 "2009-09-21T07:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris\_wesdorp](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chris\_wesdorp](https://forum.liquibase.org/u/chris_wesdorp)\
**Post date:** [September 21, 2009, 7:39am UTC](https://forum.liquibase.org/t/lb2-b3-changelog-file-with-condition-and-sequence-definition-on-mysql/250/1 "2009-09-21T07:39:00Z")

</div>

Hi,

Trying the Liquibase B3 (from subversion, revision 1157) I have the following problem. The changelog includes a changeset to create a sequence on Oracle and is marked with a pre-condition which checks the database type. When the file is executed against a MySQL database and the SQL is not executed but printed on screen, liquibase crashes on the createSequence tag.

This is the changelog

\<?xml version="1.0" encoding="UTF-8" standalone="no"?\> http://www.liquibase.org/xml/ns/dbchangelog/1.9" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance"](http://www.w3.org/2001/XMLSchema-instance%22) xsi:schemaLocation="[http://www.liquibase.org/xml/ns/dbchangelog/1.9](http://www.liquibase.org/xml/ns/dbchangelog/1.9)[http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd"\>](http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd%22>)

&nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp;

And this is the program executing liquibase:

// package and imports

public class App {

&nbsp; &nbsp; public static void main(String[] args) throws Exception {  
&nbsp; &nbsp; &nbsp; &nbsp; App a = new App();  
&nbsp; &nbsp; &nbsp; &nbsp; a.run();  
&nbsp; &nbsp; }

&nbsp; &nbsp; public void run() throws Exception {  
&nbsp; &nbsp; &nbsp; &nbsp; OracleTypeConverter otc = new OracleTypeConverter();  
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(otc.getDoubleType().toString());

&nbsp; &nbsp; &nbsp; &nbsp; Connection con = getMysqlConnection(“jdbc:mysql://localhost:3306/ht\_empty”, “test”, “test”);  
&nbsp; &nbsp; &nbsp; &nbsp; Liquibase liquibase = new Liquibase(“C:\temp\changelog\_with\_generator.xml”, new FileSystemResourceAccessor(), new JdbcConnection(con));

```
	// store the SQL in a String

```

&nbsp; &nbsp; &nbsp; &nbsp; StringWriter sw = new StringWriter();

&nbsp; &nbsp; &nbsp; &nbsp; try {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; liquibase.update(null, sw);  
&nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(e.toString());  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();  
&nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(sw.toString());  
&nbsp; &nbsp; }

&nbsp; &nbsp; private Connection getMysqlConnection(String url, String username, String password) {  
&nbsp; &nbsp; &nbsp; &nbsp; try {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class.forName(“com.mysql.jdbc.Driver”);  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Connection con = DriverManager.getConnection(url, username, password);  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return con;  
&nbsp; &nbsp; &nbsp; &nbsp; } catch (SQLException ex) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();  
&nbsp; &nbsp; &nbsp; &nbsp; } catch (ClassNotFoundException ex) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.printStackTrace();  
&nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; &nbsp; return null;  
&nbsp; &nbsp; }

}

When the SQL is executed on the database no exceptions are thrown. The change set is marked\_ran as expected in the databasechangelog table.

Regards,

Chris

---

<div class="post-metadata">

**Author:** ![chris\_wesdorp](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chris\_wesdorp](https://forum.liquibase.org/u/chris_wesdorp)\
**Post date:** [September 21, 2009, 7:39am UTC](https://forum.liquibase.org/t/lb2-b3-changelog-file-with-condition-and-sequence-definition-on-mysql/250/2 "2009-09-21T07:39:00Z")

</div>

kick…

Seems like the same issue as "[is not supported by sql file generation](http://liquibase.org/forum/index.php?topic=166.0)" but in my situation it leads to an error because the target database does not support sequences.

Chris

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [September 21, 2009, 7:39am UTC](https://forum.liquibase.org/t/lb2-b3-changelog-file-with-condition-and-sequence-definition-on-mysql/250/3 "2009-09-21T07:39:00Z")

</div>

Thanks for the kick.&nbsp; It got pushed too far down in my stack…

You are right, it is the same issue.&nbsp; I think the logic needs to be improved around the updateSQL logic and supports sequences or not.&nbsp; I am going to add a “runOnGenerateSql” flag or something similar to preconditions for 2.0 to help with this sort of issue.

Nathan
