sql statements execution error
"karthiksg.live" <[email protected]> Sun, 9 Nov 2008 18:25:58 +0530
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
------=_NextPart_000_004A_01C94298.9C91C1B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hai,
I have a problem in doing an ant build
The sql statements throw
[torque-sql-exec] =
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an =
error in your SQL syntax; check the manual that corresponds to your =
MySQL server version for the right syntax to use near 'CREATE TABLE =
Product ( id INTEGER NOT NULL, name VARCHAR (100), price FLOAT, sto' at =
line 3
I want the ant script to create the database "productmanager" at =
runtime. I'm using MySQL Server version 5.1.6
Below shown is my build.properties file:
jcdAlias=3Ddefault
databaseName=3Dproductmanager
databaseUser=3Droot
databasePassword=3Droot
tomcat.home=3D${env.CATALINA_HOME}
tomcat.url=3Dhttp://localhost:8080
tomcat.manager.url=3D${tomcat.url}/manager
# This user should be present in the =
$CATALINA_HOME/conf/tomcat-users.xml file with the role 'manager':
tomcat.username=3Dtomcat
tomcat.password=3Dtomcat
embeddedDatabase=3Dfalse
dbmsName=3DMySQL
jdbcLevel=3D3.0
jdbcRuntimeDriver=3Dcom.mysql.jdbc.Driver
urlProtocol=3Djdbc
urlSubprotocol=3Dmysql
urlDbalias=3D//localhost:3306/${databaseName}
torque.database=3Dmysql
torque.database.createUrl=3D${urlProtocol}:${urlSubprotocol}://localhost:=
3306/${databaseName}
torque.database.driver=3D${jdbcRuntimeDriver}
torque.database.user=3D${databaseUser}
torque.database.password=3D${databasePassword}
torque.database.buildUrl=3D${torque.database.createUrl}
source.dir=3Dsrc
source.java.dir=3D${source.dir}/java
source.resource.dir=3D${source.dir}/resources
source.test.dir=3D${source.dir}/test
source.schema.dir=3D${source.dir}/schema
source.webapp.dir=3D${source.dir}/webapp
build.dir=3Dbuild
lib.dir=3Dlib
lib.webapp.excludes=3Dxdoclet*.jar,xjavadoc*.jar,torque*.jar,velocity*.ja=
r
target.dir=3Dtarget
servlet.lib=3D${tomcat.home}/common/lib/servlet-api.jar
jsp.lib=3D${tomcat.home}/common/lib/jsp-api.jar
deploy.dir=3D${tomcat.home}/webapps
embedded.database.excludes=3D*schema.xml,*.sql,*.sql.generation,sqldb.map=
Below shown is the log details: (see the highlighted text in red color)
C:\Users\karthiksg\Desktop\webapp-sample\webapp-sample>ant
Buildfile: build.xml
compile:
xdoclet:
[ojbdoclet] 2008-11-09 17:51:00,188 [main] INFO =
xdoclet.XDocletMain.start - Run
ning <ojbrepository/>
[ojbdoclet] 2008-11-09 17:51:00,783 [main] INFO =
xdoclet.XDocletMain.start - Run
ning <torqueschema/>
war:
compile:
xdoclet:
[ojbdoclet] 2008-11-09 17:51:02,105 [main] INFO =
xdoclet.XDocletMain.start - Run
ning <ojbrepository/>
[ojbdoclet] 2008-11-09 17:51:02,604 [main] INFO =
xdoclet.XDocletMain.start - Run
ning <torqueschema/>
setup-db:
check-use-classpath:
check-run-only-on-schema-change:
sql-check:
sql:
[echo] +------------------------------------------+
[echo] | |
[echo] | Generating SQL for YOUR Torque project! |
[echo] | |
[echo] +------------------------------------------+
sql-classpath:
[echo] loading templates from classpath
[torque-sql] Using contextProperties file: =
C:\Users\karthiksg\Desktop\webapp-sam
ple\webapp-sample\build.properties
[torque-sql] Using classpath
[torque-sql] Generating to file =
C:\Users\karthiksg\Desktop\webapp-sample\webapp-
sample\build\database\report.productmanager.sql.generation
[torque-sql] 2008-11-09 17:51:04,499 [main] INFO =
org.apache.torque.engine.datab
ase.transform.XmlToAppData - Parsing file: 'ojbcore-schema.xml'
[torque-sql] 2008-11-09 17:51:04,522 [main] INFO =
org.apache.torque.engine.datab
ase.transform.DTDResolver - Resolver: used database.dtd from =
'org.apache.torque.
engine.database.transform' package
[torque-sql] 2008-11-09 17:51:04,595 [main] INFO =
org.apache.torque.engine.datab
ase.transform.XmlToAppData - Parsing file: 'project-schema.xml'
[torque-sql] 2008-11-09 17:51:04,600 [main] INFO =
org.apache.torque.engine.datab
ase.transform.DTDResolver - Resolver: used =
'http://db.apache.org/torque/dtd/data
base_3_0_1.dtd'
sql-template:
create-db-check:
create-db:
[torque-data-model] Using classpath
[torque-data-model] Generating to file =
C:\Users\karthiksg\Desktop\webapp-sample\
webapp-sample\build\database\create-db.sql
[torque-data-model] 2008-11-09 17:51:25,378 [main] INFO =
org.apache.torque.engin
e.database.transform.XmlToAppData - Parsing file: 'ojbcore-schema.xml'
[torque-data-model] 2008-11-09 17:51:25,392 [main] INFO =
org.apache.torque.engin
e.database.transform.DTDResolver - Resolver: used database.dtd from =
'org.apache.
torque.engine.database.transform' package
[torque-data-model] 2008-11-09 17:51:25,457 [main] INFO =
org.apache.torque.engin
e.database.transform.XmlToAppData - Parsing file: 'project-schema.xml'
[torque-data-model] 2008-11-09 17:51:25,463 [main] INFO =
org.apache.torque.engin
e.database.transform.DTDResolver - Resolver: used =
'http://db.apache.org/torque/d
td/database_3_0_1.dtd'
shutdown-check:
append-shutdown-sql:
[echo]
[echo] Executing the create-db.sql script ...
[echo]
[sql] Executing resource: =
C:\Users\karthiksg\Desktop\webapp-sample\webapp-
sample\build\database\create-db.sql
[sql] 2 of 2 SQL statements executed successfully
insert-sql:
shutdown-check:
add-shutdown-sql-file:
[torque-sql-exec] Our new url -> =
jdbc:mysql://localhost:3306/productmanager
[torque-sql-exec] Executing file: =
C:\Users\karthiksg\Desktop\webapp-sample\webap
p-sample\build\database\project-schema.sql
[torque-sql-exec] Failed to execute: # =
-----------------------------------------
------------------------------
[torque-sql-exec] # Product # =
-------------------------------------------------
----------------------
[torque-sql-exec] drop table if exists Product; CREATE TABLE Product ( =
id INTEG
ER NOT NULL, name VARCHAR (100), price FLOAT, stock INTEGER, PRIMARY =
KEY(id) );
[torque-sql-exec] =
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You
have an error in your SQL syntax; check the manual that corresponds to =
your MyS
QL server version for the right syntax to use near 'CREATE TABLE Product =
( id IN
TEGER NOT NULL, name VARCHAR (100), price FLOAT, sto' at line 3
[torque-sql-exec] Executing file: =
C:\Users\karthiksg\Desktop\webapp-sample\webap
p-sample\build\database\ojbcore-schema.sql
[torque-sql-exec] Failed to execute: # =
-----------------------------------------
------------------------------
[torque-sql-exec] # OJB_HL_SEQ # =
----------------------------------------------
-------------------------
[torque-sql-exec] drop table if exists OJB_HL_SEQ; CREATE TABLE =
OJB_HL_SEQ ( TA
BLENAME VARCHAR (250) NOT NULL, MAX_KEY BIGINT, GRAB_SIZE INTEGER, =
VERSION INTEG
ER, PRIMARY KEY(TABLENAME) ); # =
------------------------------------------------
-----------------------
[torque-sql-exec] # OJB_NRM # =
-------------------------------------------------
----------------------
[torque-sql-exec] drop table if exists OJB_NRM; CREATE TABLE OJB_NRM ( =
NAME VAR
CHAR (250) NOT NULL, OID_ LONGBLOB, PRIMARY KEY(NAME) ); # =
---------------------
--------------------------------------------------
[torque-sql-exec] # OJB_DLIST # =
-----------------------------------------------
------------------------
[torque-sql-exec] drop table if exists OJB_DLIST; CREATE TABLE =
OJB_DLIST ( ID I
NTEGER NOT NULL, SIZE_ INTEGER, PRIMARY KEY(ID) ); # =
---------------------------
--------------------------------------------
[torque-sql-exec] # OJB_DLIST_ENTRIES # =
---------------------------------------
--------------------------------
[torque-sql-exec] drop table if exists OJB_DLIST_ENTRIES; CREATE TABLE =
OJB_DLIS
T_ENTRIES ( ID INTEGER NOT NULL, DLIST_ID INTEGER NOT NULL, POSITION_ =
INTEGER, O
ID_ LONGBLOB, PRIMARY KEY(ID) ); # =
---------------------------------------------
--------------------------
[torque-sql-exec] # OJB_DSET # =
------------------------------------------------
-----------------------
[torque-sql-exec] drop table if exists OJB_DSET; CREATE TABLE OJB_DSET =
( ID INT
EGER NOT NULL, SIZE_ INTEGER, PRIMARY KEY(ID) ); # =
-----------------------------
------------------------------------------
[torque-sql-exec] # OJB_DSET_ENTRIES # =
----------------------------------------
-------------------------------
[torque-sql-exec] drop table if exists OJB_DSET_ENTRIES; CREATE TABLE =
OJB_DSET_
ENTRIES ( ID INTEGER NOT NULL, DLIST_ID INTEGER NOT NULL, POSITION_ =
INTEGER, OID
_ LONGBLOB, PRIMARY KEY(ID) ); # =
-----------------------------------------------
------------------------
[torque-sql-exec] # OJB_DMAP # =
------------------------------------------------
-----------------------
[torque-sql-exec] drop table if exists OJB_DMAP; CREATE TABLE OJB_DMAP =
( ID INT
EGER NOT NULL, SIZE_ INTEGER, PRIMARY KEY(ID) ); # =
-----------------------------
------------------------------------------
[torque-sql-exec] # OJB_DMAP_ENTRIES # =
----------------------------------------
-------------------------------
[torque-sql-exec] drop table if exists OJB_DMAP_ENTRIES; CREATE TABLE =
OJB_DMAP_
ENTRIES ( ID INTEGER NOT NULL, DMAP_ID INTEGER NOT NULL, KEY_OID =
LONGBLOB, VALUE
_OID LONGBLOB, PRIMARY KEY(ID) );
[torque-sql-exec] =
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You
have an error in your SQL syntax; check the manual that corresponds to =
your MyS
QL server version for the right syntax to use near 'CREATE TABLE =
OJB_HL_SEQ ( TA
BLENAME VARCHAR (250) NOT NULL, MAX_KEY BIGINT, GRAB' at line 3
[torque-sql-exec] 0 of 2 SQL statements executed successfully
copy-database-files:
BUILD SUCCESSFUL
Total time: 46 seconds
I can see the files build\database\createdb.sql ,
build\database\ojbcore-schema.sql ,
build\database\project-schema.sql=20
I can copy the statements from the .sql listed above and execute =
successfully in mysql command window.
kindly do the needfull.
------=_NextPart_000_004A_01C94298.9C91C1B0--