Здравствуйте уважаемы форумчанины.
Решил заполнить базу данных с помощью liquibase:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
Liquibase liquibase = null;
try {
Database db = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(conn));
try {
liquibase = new Liquibase("/conf/sql/llo.changelog.xml", new FileSystemResourceAccessor(), db);
liquibase.update("");
} catch (LiquibaseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (DatabaseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.rollback();
conn.close();
} catch (SQLException e) {
//nothing to do
}
}
}
При выполнение данного кода возникает ошибка:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
INFO 11.06.13 13:31:liquibase: Successfully acquired change log lock
INFO 11.06.13 13:31:liquibase: Reading from DATABASECHANGELOG
INFO 11.06.13 13:31:liquibase: Reading from DATABASECHANGELOG
SEVERE 11.06.13 13:31:liquibase: Change Set /conf/sql/llo.changelog.xml::init-1::ktelabs failed. Error: Error executing SQL CREATE TABLE CREATE TABLE TABLE1 (ID ${bigint.type} NOT NULL, TITLE ${string.type.long}, CONSTRAINT TABLE1_PKEY PRIMARY KEY (ID)): Неизвестный тип данных: "$"
Unknown data type: "$"; SQL statement:
CREATE TABLE TABLE1 (ID ${bigint.type} NOT NULL, TITLE ${string.type.long}, CONSTRAINT TABLE1_PKEY PRIMARY KEY (ID)) [50004-172]
liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE TABLE1 (ID ${bigint.type} NOT NULL, TITLE ${string.type.long}, CONSTRAINT TABLE1_PKEY PRIMARY KEY (ID)): Неизвестный тип данных: "$"
Unknown data type: "$"; SQL statement:
CREATE TABLE TABLE1 (ID ${bigint.type} NOT NULL, TITLE ${string.type.long}, CONSTRAINT TABLE1_PKEY PRIMARY KEY (ID)) [50004-172]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
at liquibase.Liquibase.update(Liquibase.java:114)
at ru.ktelabs.emias.llo.objects.test.CreateDataBase.createDataBase(CreateDataBase.java:69)
at ru.ktelabs.emias.llo.objects.test.CreateDataBase.start(CreateDataBase.java:51)
at ru.ktelabs.emias.llo.objects.test.Test1.SetUp(Test1.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Файл /conf/sql/llo.changelog.xml :
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
<?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" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<property name="clob.type" value="clob" dbms="oracle,h2" />
<property name="clob.type" value="text" dbms="postgresql" />
<property name="blob.type" value="blob" dbms="oracle,h2" />
<property name="blob.type" value="bytea" dbms="postgresql" />
<property name="bigint.type" value="NUMBER(19,0)" dbms="oracle" />
<property name="bigint.type" value="bigint" dbms="postgresql" />
<property name="int.type" value="NUMBER(9,0)" dbms="oracle" />
<property name="int.type" value="integer" dbms="postgresql" />
<property name="boolean.type" value="NUMBER(1,0)" dbms="oracle" />
<property name="boolean.type" value="boolean" dbms="postgresql" />
<property name="float.type" value="FLOAT(126)" dbms="oracle" />
<property name="float.type" value="double precision" dbms="postgresql" />
<property name="timestamp.type" value="TIMESTAMP(3) WITH LOCAL TIME ZONE" dbms="oracle" />
<property name="timestamp.type" value="timestamp with time zone" dbms="postgresql" />
<property name="char.type" value="CHAR(1)" dbms="oracle" />
<property name="char.type.5" value="CHAR(5)" dbms="oracle" />
<property name="char.type.8" value="CHAR(8)" dbms="oracle" />
<property name="string.type.long" value="VARCHAR2(2000 CHAR)" dbms="oracle" />
<property name="string.type.100" value="VARCHAR2(100 CHAR)" dbms="oracle" />
<property name="string.type.200" value="VARCHAR2(200 CHAR)" dbms="oracle" />
<property name="string.type.255" value="VARCHAR2(255 CHAR)" dbms="oracle" />
<property name="string.type.400" value="VARCHAR2(400 CHAR)" dbms="oracle" />
<property name="string.type.500" value="VARCHAR2(500 CHAR)" dbms="oracle" />
<property name="string.type.1000" value="VARCHAR2(1000 CHAR)" dbms="oracle" />
<property name="string.type.2000" value="VARCHAR2(2000 CHAR)" dbms="oracle" />
<property name="char.type" value="character(1)" dbms="postgresql" />
<property name="char.type.5" value="character(5)" dbms="postgresql" />
<property name="char.type.8" value="character(8)" dbms="postgresql" />
<property name="string.type.long" value="character varying(4000)" dbms="postgresql" />
<property name="string.type.100" value="character varying(100)" dbms="postgresql" />
<property name="string.type.200" value="character varying(200)" dbms="postgresql" />
<property name="string.type.255" value="character varying(255)" dbms="postgresql" />
<property name="string.type.400" value="character varying(400)" dbms="postgresql" />
<property name="string.type.500" value="character varying(500)" dbms="postgresql" />
<property name="string.type.1000" value="character varying(1000)" dbms="postgresql" />
<property name="string.type.2000" value="character varying(2000)" dbms="postgresql" />
<property name="main_seq.nextval" value="main_seq.nextval" dbms="oracle" />
<property name="main_seq.nextval" value="nextval('main_seq')" dbms="postgresql" />
- <changeSet author="test" id="init-1">
- <createTable tableName="TABLE1">
- <column name="ID" type="${bigint.type}">
<constraints nullable="false" primaryKey="true" primaryKeyName="APP_CAMPAIGN_PKEY" primaryKeyTablespace="USERS" />
</column>
<column name="TITLE" type="${string.type.long}" />
</createTable>
</changeSet>
Не могли бы вы подсказать в чем ошибка?