Re: sql statements execution error

Prestige Spas <[email protected]> Thu, 12 Feb 2009 14:54:00 -0800 (PST)
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hello All,=0A=0AI have searched the archives and not seen an answer to this=
, but I am having the =0Asame trouble with the torque "insert-sql" task, as=
 called from the OJB build.xml.=0AI have attached an old post that shows th=
e exact same problem I am seeing here. =0AMy project is assembled from ojb-=
blank.jar and my settings are similar to what is =0Areported below, except =
that I am not running inside of tomcat, simply trying to=0Adevelop in eclip=
se at this stage and run from there. =0A=0A"ant setup-db" always returns BU=
ILD SUCESSFUL but the ant task prints all the =0Asql statements together an=
d says 0 of 2 statements executed sucessfully, the =0Aproblem being a MySQL=
SyntaxErrorException thrown when torque is trying to =0Acreate the OJB_HL_S=
EQ table. I have tried this in ojb-blank.jar also and the=0Asame problem ha=
ppened from day one. =0A=0AI am running OJB 1.0.4 with mysql 5.0.51a and ve=
rsion 5.0.8 of the mysql JDBC=0Adriver. Java version is 1.5.0_16. If anyone=
 out there is able to shed any light on =0Athis I would appreciate it, as I=
 have been tearing my hair out for days on this now =0Aand I cannot think w=
hat is wrong. Obviously ojb-blank should just work out of the =0Abox with M=
ySQL, and I think i have set everything up correctly (profile=3Dmysql, =0Ae=
dit the profile/mysql.profile, torque.database=3Dmysql, dbmsName=3DMySQL). =
I have =0Atested that the driver works with SQuirreL and mysql-query-browse=
r is able to =0Aexecute the generated SQL statements *individually* from =
=0Abuild/database/project-schema.sql (but not if i simply paste the whole f=
ile).=0A=0ATIA=0A-Brian=0A=0A=0A=0A=0A=0A>Hai,=0A>=0A>I have a problem in d=
oing an ant build=0A>=0A>The sql statements throw=0A>=0A>[torque-sql-exec] =
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an erro=
r=0A>in your SQL syntax; check the manual that corresponds to your MySQL se=
rver version for the=0A>right syntax to use near 'CREATE TABLE Product ( id=
 INTEGER NOT NULL, name VARCHAR (100),=0A>price FLOAT, sto' at line 3=0A>=
=0A>I want the ant script to create the database "productmanager" at runtim=
e. I'm using MySQL=0A>Server version 5.1.6=0A>=0A>Below shown is my build.p=
roperties file:=0A>=0A>jcdAlias=3Ddefault=0A>databaseName=3Dproductmanager=
=0A>databaseUser=3Droot=0A>databasePassword=3Droot=0A>=0A>tomcat.home=3D${e=
nv.CATALINA_HOME}=0A>tomcat.url=3Dhttp://localhost:8080=0A>tomcat.manager.u=
rl=3D${tomcat.url}/manager=0A># This user should be present in the $CATALIN=
A_HOME/conf/tomcat-users.xml file with the role=0A>'manager':=0A>tomcat.use=
rname=3Dtomcat=0A>tomcat.password=3Dtomcat=0A>=0A>embeddedDatabase=3Dfalse=
=0A>=0A>dbmsName=3DMySQL=0A>jdbcLevel=3D3.0=0A>jdbcRuntimeDriver=3Dcom.mysq=
l.jdbc.Driver=0A>urlProtocol=3Djdbc=0A>urlSubprotocol=3Dmysql=0A>urlDbalias=
=3D//localhost:3306/${databaseName}=0A>=0A>torque.database=3Dmysql=0A>=0A>t=
orque.database.createUrl=3D${urlProtocol}:${urlSubprotocol}://localhost:330=
6/${databaseName}=0A>=0A>torque.database.driver=3D${jdbcRuntimeDriver}=0A>=
=0A>torque.database.user=3D${databaseUser}=0A>=0A>torque.database.password=
=3D${databasePassword}=0A>=0A>torque.database.buildUrl=3D${torque.database.=
createUrl}=0A>=0A>source.dir=3Dsrc=0A>source.java.dir=3D${source.dir}/java=
=0A>source.resource.dir=3D${source.dir}/resources=0A>source.test.dir=3D${so=
urce.dir}/test=0A>source.schema.dir=3D${source.dir}/schema=0A>source.webapp=
.dir=3D${source.dir}/webapp=0A>=0A>build.dir=3Dbuild=0A>lib.dir=3Dlib=0A>li=
b.webapp.excludes=3Dxdoclet*.jar,xjavadoc*.jar,torque*.jar,velocity*.jar=0A=
>=0A>target.dir=3Dtarget=0A>=0A>servlet.lib=3D${tomcat.home}/common/lib/ser=
vlet-api.jar=0A>jsp.lib=3D${tomcat.home}/common/lib/jsp-api.jar=0A>deploy.d=
ir=3D${tomcat.home}/webapps=0A>=0A>embedded.database.excludes=3D*schema.xml=
,*.sql,*.sql.generation,sqldb.map=0A>=0A>=0A>=0A>Below shown is the log det=
ails: (see the highlighted text in red color)=0A>=0A>C:\Users\karthiksg\Des=
ktop\webapp-sample\webapp-sample>ant=0A>Buildfile: build.xml=0A>=0A>compile=
:=0A>=0A>xdoclet:=0A>[ojbdoclet] 2008-11-09 17:51:00,188 [main] INFO  xdocl=
et.XDocletMain.start - Run=0A>ning <ojbrepository/>=0A>[ojbdoclet] 2008-11-=
09 17:51:00,783 [main] INFO  xdoclet.XDocletMain.start - Run=0A>ning <torqu=
eschema/>=0A>=0A>war:=0A>=0A>compile:=0A>=0A>xdoclet:=0A>[ojbdoclet] 2008-1=
1-09 17:51:02,105 [main] INFO  xdoclet.XDocletMain.start - Run=0A>ning <ojb=
repository/>=0A>[ojbdoclet] 2008-11-09 17:51:02,604 [main] INFO  xdoclet.XD=
ocletMain.start - Run=0A>ning <torqueschema/>=0A>=0A>setup-db:=0A>=0A>check=
-use-classpath:=0A>=0A>check-run-only-on-schema-change:=0A>=0A>sql-check:=
=0A>=0A>sql:=0A>[echo] +------------------------------------------+=0A>[ech=
o] |                                          |=0A>[echo] | Generating SQL =
for YOUR Torque project!  |=0A>[echo] |                                    =
      |=0A>[echo] +------------------------------------------+=0A>=0A>sql-c=
lasspath:=0A>[echo] loading templates from classpath=0A>[torque-sql] Using =
contextProperties file: C:\Users\karthiksg\Desktop\webapp-sam=0A>ple\webapp=
-sample\build.properties=0A>[torque-sql] Using classpath=0A>[torque-sql] Ge=
nerating to file C:\Users\karthiksg\Desktop\webapp-sample\webapp-=0A>sample=
\build\database\report.productmanager.sql.generation=0A>[torque-sql] 2008-1=
1-09 17:51:04,499 [main] INFO  org.apache.torque.engine.datab=0A>ase.transf=
orm.XmlToAppData - Parsing file: 'ojbcore-schema.xml'=0A>[torque-sql] 2008-=
11-09 17:51:04,522 [main] INFO  org.apache.torque.engine.datab=0A>ase.trans=
form.DTDResolver - Resolver: used database.dtd from 'org.apache.torque.=0A>=
engine.database.transform' package=0A>[torque-sql] 2008-11-09 17:51:04,595 =
[main] INFO  org.apache.torque.engine.datab=0A>ase.transform.XmlToAppData -=
 Parsing file: 'project-schema.xml'=0A>[torque-sql] 2008-11-09 17:51:04,600=
 [main] INFO  org.apache.torque.engine.datab=0A>ase.transform.DTDResolver -=
 Resolver: used 'http://db.apache.org/torque/dtd/data=0A>base_3_0_1.dtd'=0A=
>=0A>sql-template:=0A>=0A>create-db-check:=0A>=0A>create-db:=0A>[torque-dat=
a-model] Using classpath=0A>[torque-data-model] Generating to file C:\Users=
\karthiksg\Desktop\webapp-sample\=0A>webapp-sample\build\database\create-db=
.sql=0A>[torque-data-model] 2008-11-09 17:51:25,378 [main] INFO  org.apache=
.torque.engin=0A>e.database.transform.XmlToAppData - Parsing file: 'ojbcore=
-schema.xml'=0A>[torque-data-model] 2008-11-09 17:51:25,392 [main] INFO  or=
g.apache.torque.engin=0A>e.database.transform.DTDResolver - Resolver: used =
database.dtd from 'org.apache.=0A>torque.engine.database.transform' package=
=0A>[torque-data-model] 2008-11-09 17:51:25,457 [main] INFO  org.apache.tor=
que.engin=0A>e.database.transform.XmlToAppData - Parsing file: 'project-sch=
ema.xml'=0A>[torque-data-model] 2008-11-09 17:51:25,463 [main] INFO  org.ap=
ache.torque.engin=0A>e.database.transform.DTDResolver - Resolver: used 'htt=
p://db.apache.org/torque/d=0A>td/database_3_0_1.dtd'=0A>=0A>shutdown-check:=
=0A>=0A>append-shutdown-sql:=0A>[echo]=0A>[echo]       Executing the create=
-db.sql script ...=0A>[echo]=0A>[sql] Executing resource: C:\Users\karthiks=
g\Desktop\webapp-sample\webapp-=0A>sample\build\database\create-db.sql=0A>[=
sql] 2 of 2 SQL statements executed successfully=0A>=0A>insert-sql:=0A>=0A>=
shutdown-check:=0A>=0A>add-shutdown-sql-file:=0A>[torque-sql-exec] Our new =
url -> jdbc:mysql://localhost:3306/productmanager=0A>[torque-sql-exec] Exec=
uting file: C:\Users\karthiksg\Desktop\webapp-sample\webap=0A>p-sample\buil=
d\database\project-schema.sql=0A>[torque-sql-exec] Failed to execute: # ---=
--------------------------------------=0A>------------------------------=0A=
>[torque-sql-exec]  # Product # -------------------------------------------=
------=0A>----------------------=0A>[torque-sql-exec]  drop table if exists=
 Product; CREATE TABLE Product ( id INTEG=0A>ER NOT NULL, name VARCHAR (100=
), price FLOAT, stock INTEGER, PRIMARY KEY(id) );=0A>[torque-sql-exec] com.=
mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You=0A>have an error=
 in your SQL syntax; check the manual that corresponds to your MyS=0A>QL se=
rver version for the right syntax to use near 'CREATE TABLE Product ( id IN=
=0A>TEGER NOT NULL, name VARCHAR (100), price FLOAT, sto' at line 3=0A>[tor=
que-sql-exec] Executing file: C:\Users\karthiksg\Desktop\webapp-sample\weba=
p=0A>p-sample\build\database\ojbcore-schema.sql=0A>[torque-sql-exec] Failed=
 to execute: # -----------------------------------------=0A>---------------=
---------------=0A>[torque-sql-exec]  # OJB_HL_SEQ # ----------------------=
------------------------=0A>-------------------------=0A>[torque-sql-exec] =
 drop table if exists OJB_HL_SEQ; CREATE TABLE OJB_HL_SEQ ( TA=0A>BLENAME V=
ARCHAR (250) NOT NULL, MAX_KEY BIGINT, GRAB_SIZE INTEGER, VERSION INTEG=0A>=
ER, PRIMARY KEY(TABLENAME) ); # -------------------------------------------=
-----=0A>-----------------------=0A>[torque-sql-exec]  # OJB_NRM # --------=
-----------------------------------------=0A>----------------------=0A>[tor=
que-sql-exec]  drop table if exists OJB_NRM; CREATE TABLE OJB_NRM ( NAME VA=
R=0A>CHAR (250) NOT NULL, OID_ LONGBLOB, PRIMARY KEY(NAME) ); # -----------=
----------=0A>--------------------------------------------------=0A>[torque=
-sql-exec]  # OJB_DLIST # -----------------------------------------------=
=0A>------------------------=0A>[torque-sql-exec]  drop table if exists OJB=
_DLIST; CREATE TABLE OJB_DLIST ( ID I=0A>NTEGER NOT NULL, SIZE_ INTEGER, PR=
IMARY KEY(ID) ); # ---------------------------=0A>-------------------------=
-------------------=0A>[torque-sql-exec]  # OJB_DLIST_ENTRIES # -----------=
----------------------------=0A>--------------------------------=0A>[torque=
-sql-exec]  drop table if exists OJB_DLIST_ENTRIES; CREATE TABLE OJB_DLIS=
=0A>T_ENTRIES ( ID INTEGER NOT NULL, DLIST_ID INTEGER NOT NULL, POSITION_ I=
NTEGER, O=0A>ID_ LONGBLOB, PRIMARY KEY(ID) ); # ---------------------------=
------------------=0A>--------------------------=0A>[torque-sql-exec]  # OJ=
B_DSET # ------------------------------------------------=0A>--------------=
---------=0A>[torque-sql-exec]  drop table if exists OJB_DSET; CREATE TABLE=
 OJB_DSET ( ID INT=0A>EGER NOT NULL, SIZE_ INTEGER, PRIMARY KEY(ID) ); # --=
---------------------------=0A>------------------------------------------=
=0A>[torque-sql-exec]  # OJB_DSET_ENTRIES # -------------------------------=
---------=0A>-------------------------------=0A>[torque-sql-exec]  drop tab=
le if exists OJB_DSET_ENTRIES; CREATE TABLE OJB_DSET_=0A>ENTRIES ( ID INTEG=
ER NOT NULL, DLIST_ID INTEGER NOT NULL, POSITION_ INTEGER, OID=0A>_ LONGBLO=
B, PRIMARY KEY(ID) ); # -----------------------------------------------=0A>=
------------------------=0A>[torque-sql-exec]  # OJB_DMAP # ---------------=
---------------------------------=0A>-----------------------=0A>[torque-sql=
-exec]  drop table if exists OJB_DMAP; CREATE TABLE OJB_DMAP ( ID INT=0A>EG=
ER NOT NULL, SIZE_ INTEGER, PRIMARY KEY(ID) ); # --------------------------=
---=0A>------------------------------------------=0A>[torque-sql-exec]  # O=
JB_DMAP_ENTRIES # ----------------------------------------=0A>-------------=
------------------=0A>[torque-sql-exec]  drop table if exists OJB_DMAP_ENTR=
IES; CREATE TABLE OJB_DMAP_=0A>ENTRIES ( ID INTEGER NOT NULL, DMAP_ID INTEG=
ER NOT NULL, KEY_OID LONGBLOB, VALUE=0A>_OID LONGBLOB, PRIMARY KEY(ID) );=
=0A>[torque-sql-exec] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExcep=
tion: You=0A>have an error in your SQL syntax; check the manual that corres=
ponds to your MyS=0A>QL server version for the right syntax to use near 'CR=
EATE TABLE OJB_HL_SEQ ( TA=0A>BLENAME VARCHAR (250) NOT NULL, MAX_KEY BIGIN=
T, GRAB' at line 3=0A>[torque-sql-exec] 0 of 2 SQL statements executed succ=
essfully=0A>=0A>copy-database-files:=0A>=0A>BUILD SUCCESSFUL=0A>Total time:=
 46 seconds=0A>=0A>I can see the files build\database\createdb.sql ,=0A>bui=
ld\database\ojbcore-schema.sql ,=0A>build\database\project-schema.sql =0A>=
=0A>I can copy the statements from the .sql listed above and execute succes=
sfully in mysql command=0A>window.=0A>=0A>kindly do the needfull.=0A=0A=0A =
     Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find =
out more