You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Laurent Sacaut <ls...@8d.com> on 2006/03/01 00:55:47 UTC

Re: setup-db problems

Hi Tom,

I tested the sql statements generated by torque in project--schema under
build/database directly in the mysql command-line AND using mysqlcc and
they work just fine.
I then created a small java class with a simple jdbc connection to run
the same statment and i got some interesting results.

When I use the executeQuery method such as stmt.executeQuery(sSQL); a
similar error as mentioned in the original post stating that there is a
syntax error or access violation. (I used a user/password combination
that had rights to do so)
Then I tried the executeUpdate method.

I get no error when each statement is passed to the method separately.
When I feed the whole file as a string, such as the 'drop table if
exists ...' statement and the 'create table ...' statement separated by
a semi-colon (;), I get a syntax error near the ';', which seems to make
sense since the javadoc on the Statement java class does not mention
that it can process multiple sql statements.

I would think Torque would be able to handle this situation, maybe I am
missing a library.

It seems that I am running into a parsing problem. I noticed that
ojb-blank does not contain xercesImpl.jar, so I added one from another
project but the version of it might be more or less compatible.
How come the build-torque file refers to libraries that are not present
in ojb-blank?

thx
Laurent


Thomas Dudziak wrote:

>On 2/28/06, Laurent Sacaut <ls...@8d.com> wrote:
>
>  
>
>>I ran the sql generated by torque as you suggested (the 3 files it
>>created: create-db.sql, ojbcore-schema.sql and project-schema.sql) and
>>they are fine. No error from MySQL 5.0 and all the tables are created.
>>
>>I am suspecting something subtile such as the order of the jar, or other
>>configuration settings or file location.
>>    
>>
>
>It could be anything really. You should ensure that you're using the
>newest JDBC driver. And you could test to execute the creation sql
>with your connection settings in a tool like Squirrel SQL
>(http://squirrel-sql.sourceforge.net/) to ensure that the user (i.e.
>'user@computer') is allowed to do this.
>
>Tom
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: setup-db problems

Posted by Thomas Dudziak <to...@gmail.com>.
On 3/1/06, Laurent Sacaut <ls...@8d.com> wrote:

> I tested the sql statements generated by torque in project--schema under
> build/database directly in the mysql command-line AND using mysqlcc and
> they work just fine.

Please use a tool that uses the JDBC driver, e.g. Squirrel SQL, or
Ant's sql task.

> I then created a small java class with a simple jdbc connection to run
> the same statment and i got some interesting results.
>
> When I use the executeQuery method such as stmt.executeQuery(sSQL); a
> similar error as mentioned in the original post stating that there is a
> syntax error or access violation. (I used a user/password combination
> that had rights to do so)
> Then I tried the executeUpdate method.
>
> I get no error when each statement is passed to the method separately.
> When I feed the whole file as a string, such as the 'drop table if
> exists ...' statement and the 'create table ...' statement separated by
> a semi-colon (;), I get a syntax error near the ';', which seems to make
> sense since the javadoc on the Statement java class does not mention
> that it can process multiple sql statements.
>
> I would think Torque would be able to handle this situation, maybe I am
> missing a library.

That is to be expected because AFAIK Torque does not execute the
generated SQL in one execute call but rather splits them.

> It seems that I am running into a parsing problem. I noticed that
> ojb-blank does not contain xercesImpl.jar, so I added one from another
> project but the version of it might be more or less compatible.
> How come the build-torque file refers to libraries that are not present
> in ojb-blank?

This is because its quite big, and all newer java distributions
contain an XML parser (I don't think Torque specifically needs Xerces,
they only require an XML parser), so there is usually no need to
include it into ojb-blank. Btw, you would have encountered an XML
parser way before these SQL problems - in fact you should not get that
far at all if you miss an XML parser.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org