opensubscriber
   Find in this group all groups
 
Unknown more information…

o : ojb-user@db.apache.org 9 November 2008 • 9:55PM -0500

sql statements execution error
by karthiksg.live

REPLY TO AUTHOR
 
REPLY TO GROUP



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=default
databaseName=productmanager
databaseUser=root
databasePassword=root

tomcat.home=${env.CATALINA_HOME}
tomcat.url=http://localhost:8080
tomcat.manager.url=${tomcat.url}/manager
# This user should be present in the $CATALINA_HOME/conf/tomcat-users.xml file with the role 'manager':
tomcat.username=tomcat
tomcat.password=tomcat

embeddedDatabase=false

dbmsName=MySQL
jdbcLevel=3.0
jdbcRuntimeDriver=com.mysql.jdbc.Driver
urlProtocol=jdbc
urlSubprotocol=mysql
urlDbalias=//localhost:3306/${databaseName}

torque.database=mysql

torque.database.createUrl=${urlProtocol}:${urlSubprotocol}://localhost:3306/${databaseName}

torque.database.driver=${jdbcRuntimeDriver}

torque.database.user=${databaseUser}

torque.database.password=${databasePassword}

torque.database.buildUrl=${torque.database.createUrl}

source.dir=src
source.java.dir=${source.dir}/java
source.resource.dir=${source.dir}/resources
source.test.dir=${source.dir}/test
source.schema.dir=${source.dir}/schema
source.webapp.dir=${source.dir}/webapp

build.dir=build
lib.dir=lib
lib.webapp.excludes=xdoclet*.jar,xjavadoc*.jar,torque*.jar,velocity*.jar

target.dir=target

servlet.lib=${tomcat.home}/common/lib/servlet-api.jar
jsp.lib=${tomcat.home}/common/lib/jsp-api.jar
deploy.dir=${tomcat.home}/webapps

embedded.database.excludes=*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

I can copy the statements from the .sql listed above and execute successfully in mysql command window.

kindly do the needfull.



Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.