Patrick Villacorta wrote:
Hi,
I'm trying to convert an HSQL SQL script to Derby SQL syntax. I've
gotten stuck with this error: "Syntax error: Encountered "\'" at line
1, column 844.". Any insight on what's going on?
Here's the Stack trace:
jvm 1 | org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'liferaySchemaCreator' defined in file
[C:\logicblaze\source\fuse\target\fuse-1.2-SNAPSHOT\components\jndi\jndi-xbean.xml]:
Initialization of bean failed; nested exception is
org.apache.ddlutils.DynaSqlException: Error while executing SQL INSERT
INTO JOURNALTEMPLATE
VALUES('liferay.com','ABOUTUS-NEWS','2','admin','Joe
Bloggs','2006-04-05 22:59:21.108','2006-04-05
22:59:21.108','ABOUTUS-NEWS','About Us News','Custom template for
News','<?xml version="1.0"?>\u000a\u000a<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
\u000a <xsl:template match="/"> \u000a <link rel="alternate"
type="application/rss+xml" title="Liferay RSS Feed"
href="http://@portal_url@/cms/servlet/news-rss-feed?mimeType=application/rss+xml"/>
\u000a <xsl:if
test="root/[EMAIL PROTECTED]''main-text'']/dynamic-content !=
''''">\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''main-text'']/dynamic-content"/>
\u000a <br/>\u000a <br/>\u000a </xsl:if>\u000a
<xsl:variable name="articles"
select="document(''http://@portal_url@/c/journal/get_articles?templateId=BASIC-RSS-ITEM&
jvm 1 | org.apache.ddlutils.DynaSqlException: Error while executing
SQL INSERT INTO JOURNALTEMPLATE
VALUES('liferay.com','ABOUTUS-NEWS','2','admin','Joe
Bloggs','2006-04-05 22:59:21.108','2006-04-05
22:59:21.108','ABOUTUS-NEWS','About Us News','Custom template for
News','<?xml version="1.0"?>\u000a\u000a<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
\u000a <xsl:template match="/"> \u000a <link rel="alternate"
type="application/rss+xml" title="Liferay RSS Feed"
href="http://@portal_url@/cms/servlet/news-rss-feed?mimeType=application/rss+xml"/>
\u000a <xsl:if
test="root/[EMAIL PROTECTED]''main-text'']/dynamic-content !=
''''">\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''main-text'']/dynamic-content"/>
\u000a <br/>\u000a <br/>\u000a </xsl:if>\u000a
<xsl:variable name="articles"
select="document(''http://@portal_url@/c/journal/get_articles?templateId=BASIC-RSS-ITEM&
jvm 1 | at
org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(PlatformImplBase.java:218)
jvm 1 | at
org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(PlatformImplBase.java:160)
jvm 1 | at
org.logicblaze.soa.SchemaCreator.afterPropertiesSet(SchemaCreator.java:89)
jvm 1 | at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
jvm 1 | at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
jvm 1 | at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
jvm 1 | at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
jvm 1 | at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
jvm 1 | at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
jvm 1 | at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:83)
jvm 1 | at
org.apache.xbean.server.deployer.FileDeployer.createServiceForFile(FileDeployer.java:344)
jvm 1 | at
org.apache.xbean.server.deployer.FileDeployer.processDirectory(FileDeployer.java:277)
jvm 1 | at
org.apache.xbean.server.deployer.FileDeployer.processDirectory(FileDeployer.java:288)
jvm 1 | at
org.apache.xbean.server.deployer.FileDeployer.afterPropertiesSet(FileDeployer.java:88)
jvm 1 | at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
jvm 1 | at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
jvm 1 | at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
jvm 1 | at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
jvm 1 | at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:275)
jvm 1 | at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
jvm 1 | at
org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:158)
jvm 1 | at
org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:48)
jvm 1 | at
org.apache.xbean.server.spring.main.SpringBootstrap.loadMain(SpringBootstrap.java:265)
jvm 1 | at
org.apache.xbean.server.spring.main.SpringBootstrap.boot(SpringBootstrap.java:287)
jvm 1 | at
org.apache.xbean.server.spring.main.SpringBootstrap.main(SpringBootstrap.java:90)
jvm 1 | at
org.logicblaze.soa.BootstrapMain.main(BootstrapMain.java:41)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
jvm 1 | at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1 | at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:585)
jvm 1 | at org.logicblaze.soa.Main.runTaskClass(Main.java:164)
jvm 1 | at org.logicblaze.soa.Main.main(Main.java:76)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
jvm 1 | at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1 | at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:585)
jvm 1 | at
org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:197)
jvm 1 | at java.lang.Thread.run(Thread.java:595)
jvm 1 | Caused by: SQL Exception: Syntax error: Encountered "\'" at
line 1, column 844.
jvm 1 | at
org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java)
jvm 1 | at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java)
jvm 1 | at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java)
jvm 1 | at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java)
jvm 1 | at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java)
jvm 1 | at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java)
jvm 1 | at
org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(EmbedStatement.java)
jvm 1 | at
org.apache.ddlutils.platform.PlatformImplBase.evaluateBatch(PlatformImplBase.java:202)
jvm 1 | ... 37 more
wrapper | <-- Wrapper Stopped
Here's the complete SQL statement:
INSERT INTO JOURNALTEMPLATE
VALUES('liferay.com','ABOUTUS-NEWS','2','admin','Joe
Bloggs','2006-04-05 22:59:21.108','2006-04-05
22:59:21.108','ABOUTUS-NEWS','About Us News','Custom template for
News','<?xml version="1.0"?>\u000a\u000a<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
\u000a <xsl:template match="/"> \u000a <link rel="alternate"
type="application/rss+xml" title="Liferay RSS Feed"
href="http://@portal_url@/cms/servlet/news-rss-feed?mimeType=application/rss+xml"/>
\u000a <xsl:if
test="root/[EMAIL PROTECTED]''main-text'']/dynamic-content !=
''''">\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''main-text'']/dynamic-content"/>
\u000a <br/>\u000a <br/>\u000a </xsl:if>\u000a
<xsl:variable name="articles"
select="document(''http://@portal_url@/c/journal/get_articles?templateId=BASIC-RSS-ITEM&delta=4&orderBy=displayDate'')/result-set/result"/>
\u000a <xsl:for-each select="$articles"> \u000a <b>
\u000a <a> \u000a <xsl:attribute name="href">
\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''link'']/dynamic-content"/>
\u000a </xsl:attribute> \u000a <xsl:value-of
disable-output-escaping="yes" select="reserved-info/title"/>
\u000a </a> \u000a </b> \u000a <br/> \u000a
<font color="#777777"> \u000a <xsl:text>(</xsl:text>
\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''creator'']/dynamic-content"/>
\u000a <xsl:text>)</xsl:text> \u000a </font> \u000a
<br/> \u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''description'']/dynamic-content"/>
\u000a <br/> \u000a <br/> \u000a </xsl:for-each> \u000a
</xsl:template> \u000a</xsl:stylesheet>','xsl',0,'');
The create table statement might help:
CREATE TABLE JOURNALTEMPLATE(COMPANYID VARCHAR(75) NOT NULL,TEMPLATEID
VARCHAR(75) NOT NULL,GROUPID VARCHAR(75) NOT NULL,USERID VARCHAR(75)
NOT NULL,USERNAME VARCHAR(75),CREATEDATE TIMESTAMP,MODIFIEDDATE
TIMESTAMP,STRUCTUREID VARCHAR(75),NAME VARCHAR(75),DESCRIPTION LONG
VARCHAR,XSL LONG VARCHAR,LANGTYPE VARCHAR(75),SMALLIMAGE
SMALLINT,SMALLIMAGEURL VARCHAR(75),CONSTRAINT SPKJOURNALTEMPLATE
PRIMARY KEY(COMPANYID,TEMPLATEID));
Thanks,
Patrick
Hi Patrick,
The Insert you mentioned in your mail works fine in Derby when run under
the ij tool separately:
ij version 10.1
ij> connect 'jdbc:derby:testdb;create=true';
WARNING 01J01: Database 'testdb' not created, connection made to
existing database instead.
ij> CREATE TABLE JOURNALTEMPLATE(COMPANYID VARCHAR(75) NOT
NULL,TEMPLATEID VARCHAR(75) NOT NULL,GROUPID VARCHAR(75) NOT
NULL,USERID VARCHAR(75) NOT NULL,USERNAME VARCHAR(75),CREATEDATE
TIMESTAMP,MODIFIEDDATE TIMESTAMP,STRUCTUREID VARCHAR(75
),NAME VARCHAR(75),DESCRIPTION LONG VARCHAR,XSL LONG VARCHAR,LANGTYPE
VARCHAR(75),SMALLIMAGE SMALLINT,SMALLIMAGEURL VARC
HAR(75),CONSTRAINT SPKJOURNALTEMPLATE PRIMARY KEY(COMPANYID,TEMPLATEID));
0 rows inserted/updated/deleted
ij>
INSERT INTO JOURNALTEMPLATE
VALUES('liferay.com','ABOUTUS-NEWS','2','admin','Joe Bloggs','2006-04-05
22:59:21.108','2006
-04-05 22:59:21.108','ABOUTUS-NEWS','About Us News','Custom template for
News','<?xml version="1.0"?>\u000a\u000a<xsl:st
ylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> \u000a <xsl:template match="/"> \u000a <li
nk rel="alternate" type="application/rss+xml" title="Liferay RSS Feed"
href="http://@portal_url@/cms/servlet/news-rss-fe
ed?mimeType=application/rss+xml"/> \u000a <xsl:if
test="root/[EMAIL PROTECTED]''main-text'']/dynamic-content !=
''''">\u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''main-text'']/dynamic
-content"/> \u000a <br/>\u000a <br/>\u000a
</xsl:if>\u000a <xsl:variable name="articles" select="documen
t(''http://@portal_url@/c/journal/get_articles?templateId=BASIC-RSS-ITEM&delta=4&orderBy=displayDate'')/result-s
et/result"/> \u000a <xsl:for-each select="$articles"> \u000a
<b> \u000a <a> \u000a <xsl:attribu
te name="href"> \u000a <xsl:value-of
disable-output-escaping="yes" select="root/[EMAIL PROTECTED]''link'
']/dynamic-content"/> \u000a </xsl:attribute> \u000a
<xsl:value-of disable-output-escaping="yes" sele
ct="reserved-info/title"/> \u000a </a> \u000a </b>
\u000a <br/> \u000a <font color="#777777"> \u
000a <xsl:text>(</xsl:text> \u000a <xsl:value-of
disable-output-escaping="yes" select="root/dynamic-eleme
[EMAIL PROTECTED]''creator'']/dynamic-content"/> \u000a
<xsl:text>)</xsl:text> \u000a </font> \u000a <br/> \
u000a <xsl:value-of disable-output-escaping="yes"
select="root/[EMAIL PROTECTED]''description'']/dynamic-conte
nt"/> \u000a <br/> \u000a <br/> \u000a </xsl:for-each>
\u000a </xsl:template> \u000a</xsl:stylesheet>','
xsl',0,'');
1 row inserted/updated/deleted
ij> select * from JOURNALTEMPLATE;
COMPANYID
|TEMPLATEID
|GROUPID
|USERID
|USERNAME
|CREATEDATE |MODIFIEDDATE
|STRUCTUREID
|NAME
|DESCRIPTION
|XSL
|LANGTYPE
|SMALL&|SMALLIMAGEURL
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------
liferay.com
|ABOUTUS-NEWS
|2
|admin
|Joe Bloggs
|2006-04-05 22:59:21.108 |2006-04-05 22:59:21.108
|ABOUTUS-NEWS
|About Us
News
|Custom templat
e for
News
|<?xml
version="1.0"?>\u000a\u000a<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> \u000a <xs
l:&|xsl
|0 |
1 row selected
In your case, the error "Syntax error: Encountered "\'" at line 1,
column 844." seem to be coming from
<snip>......<xsl:variable name="articles" select="document('
.....</snip>. in the statement, which works fine when run as a SQL statement
in ij.
Also, I noticed you are using the Apache ddlUtils, is it possible to
run the migration separately outside using ddlUtils without the Spring
framework.
Maybe the following link will be useful is doing so:
http://db.apache.org/derby/integrate/db_ddlutils.html
Regards,
Rajesh