You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Gareth Coltman <ga...@majorband.co.uk> on 2001/04/18 15:36:03 UTC

AGH! Oracle is painful

Hello all,

Thanks for all your help thus far. I am struggling to get Turbine to write
any data to the oracle database.

I have create a peer for my database table by hand:

- <database>
- <table name="T_PROPERTIES" idMethod="none">
  <column name="ID" autoIncrement="true" required="true" primaryKey="true"
type="INTEGER" />
  <column name="NAME" size="100" type="VARCHAR" />
  <column name="POSTCODE" size="8" type="VARCHAR" />
  </table>
  </database>

It would be great if I could configure the build script to connect to oracle
and query my database and create my schemas for me. I guess I could output a
SQL create script and convert that to XML... Anyway.

Upon trying to use the save method I get the following warning:

"IDBroker is being used with db: default
 which does not support transactions.  It is possible to
 generate duplicate keys, if multiple JVM's are used or other
 means are used to write to the database."

(Where was I supposed to inform the ID broker to user Oracle?)

Then I get a null pointer exception.

Apparently the TDK has been tested with Oracle(?). I would prefer to use
sequences as I said but am happy to use the IDBROKER if this will make my
life much easier. At the moment I can't do any kind of update.

I have debugged it and found that it is failing in the Save method in the
BaseObject class:

BasePeer.beginTransaction(TPropertiesPeer.getMapBuilder().getDatabaseMap().g
etName());

produces a null value and thus an exception...

Man, this was soooo much easier with MySQL....

Cheers,

Gareth


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 6:06 AM, "Jason van Zyl" <jv...@apache.org> wrote:
> 
> > It is probably worth fixing up the JDBC->XML task then, it is not
> > fully integrated with the rest of the torque setup. It would be of
> > great use to have this functionality back. I didn't keep it updated
> > when I initially merged the two existing versions of torque, and
> > it subsequently has not been kept up-to-date WRT to schema changes
> > in torque.
> >
> > If you send me questions in private I can answer any questions if you
> > want to try and get it running, but I don't have time in the next
> > while to get it working completely.
> 
> No, it isn't. The JDBC->XML task will fail miserably with some
> databases...like MySQL...it is much better to parse the output of a .sql
> file than it is to try to get the information from JDBC.

Well, we should have both methods because I completely disagree about
the ease of parsing SQL. And I've had the JDBC->XML work fine in
lots of cases. Both tasks should work and people can use what
is suitable for the job.

> 
> -jon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 6:06 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> It is probably worth fixing up the JDBC->XML task then, it is not
> fully integrated with the rest of the torque setup. It would be of
> great use to have this functionality back. I didn't keep it updated
> when I initially merged the two existing versions of torque, and
> it subsequently has not been kept up-to-date WRT to schema changes
> in torque.
> 
> If you send me questions in private I can answer any questions if you
> want to try and get it running, but I don't have time in the next
> while to get it working completely.

No, it isn't. The JDBC->XML task will fail miserably with some
databases...like MySQL...it is much better to parse the output of a .sql
file than it is to try to get the information from JDBC.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Gareth Coltman wrote:
> 
> > I just fixed it in CVS so that it works. It is not at all forgiving
> > with the SQL you throw at it but it might take you part of the way.
> > I tried three sql files and only the simplest one worked.
> 
> I have an up-to-date CVS Jakarta-turbine module, but I still get the same
> error. Maybe I'm not copying the right jar's into my TDK. (See my other
> email)
> 
> > What might work better for you is the JDBC -> XML process. I looked
> > at the code a couple minutes ago and I don't think it will work
> > in its current state. You might want to try and fix that up and
> > use that though it's probably not up-to-date WRT the XML schema
> > it produces. It's on my list to fix but it's way at the bottom. If
> > you're desperate I will take a look at it tonight.
> 
> I've never heard of this before. It sounds great. I am trying to produce a
> schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> it by hand. ;)

It is probably worth fixing up the JDBC->XML task then, it is not
fully integrated with the rest of the torque setup. It would be of
great use to have this functionality back. I didn't keep it updated
when I initially merged the two existing versions of torque, and 
it subsequently has not been kept up-to-date WRT to schema changes
in torque.

If you send me questions in private I can answer any questions if you
want to try and get it running, but I don't have time in the next
while to get it working completely.

> 
> Thanks for your help.
> 
> Gareth
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> Why would you not recommend the JDBC->XML process? You just say
> no, without qualification?

Simple:

MySQL does not internally keep the data about relationships between tables.
There is no foreign key information so your output in XML will be totally
missing that piece. The .sql file isn't much better, but at least you have a
place to define it with copy/paste instead of having to do that with the
.xml file after the fact.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: AGH! Oracle is painful

Posted by Howard Lin <hl...@vonage.com>.
Well, I managed to make SQL2XML working with Oracle scripts. I use TOAD to
generate the Table Create script.
Here are what I found out:
1) should not have CONSTRAINT in the script
2) should not have TABLESACE, STORAGE, PCTFREE etc.
3) should use ; instead of /
5) must have primaryKey otherwise you will get a "comboPK undefined" error
when compiling generated Java file due to a bug in Object.vm (I submitted a
fix)

Check torque.xml for how to add sql-xml taskdefs. You can also test your
script by typing

"java -cp ..\lib\turbine-2.1-dev-unreleased.jar
org.apache.turbine.torque.engine.database.transform.SQLToAppData script.sql"

Howard

-----Original Message-----
From: Gareth Coltman [mailto:gareth_coltman@majorband.co.uk]
Sent: Tuesday, April 24, 2001 4:14 AM
To: turbine-dev@jakarta.apache.org
Subject: RE: AGH! Oracle is painful


> > The SQL->XML doesn't
> > > work very well at all. I could only get it to work with a very small
> > > number of SQL files I tried. I tried scarabs sql schema and it just
> > > hangs there. I don't think that parser would work very well on
> > > nasty Oracle SQL either.
> >

Hmm. Well, for me it doesn't work at all..

I have the latest build of the turbine.jar. I have copied it into my apps
lib directory. Upon running the task like this:

build-project sql2xml

I get:

BUILD FAILED

C:\tdk\webapps\devsite\WEB-INF\build\build-project.xml:442: Could not create
task of type: sql-xml. Common solutions are to use taskdef to declare your
task, or, if this is an optional task, to put the optional.jar in the lib
directory of your ant installation (ANT_HOME).

This is running on a W2K machine. I will happily test SQL->XML (and happily
fix it if it doesn't work on nasty Oracle sql..!) if I can get it top work.

Gareth



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
> > The SQL->XML doesn't
> > > work very well at all. I could only get it to work with a very small
> > > number of SQL files I tried. I tried scarabs sql schema and it just
> > > hangs there. I don't think that parser would work very well on
> > > nasty Oracle SQL either.
> >

Hmm. Well, for me it doesn't work at all..

I have the latest build of the turbine.jar. I have copied it into my apps
lib directory. Upon running the task like this:

build-project sql2xml

I get:

BUILD FAILED

C:\tdk\webapps\devsite\WEB-INF\build\build-project.xml:442: Could not create
task of type: sql-xml. Common solutions are to use taskdef to declare your
task, or, if this is an optional task, to put the optional.jar in the lib
directory of your ant installation (ANT_HOME).

This is running on a W2K machine. I will happily test SQL->XML (and happily
fix it if it doesn't work on nasty Oracle sql..!) if I can get it top work.

Gareth



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 11:03 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> I know, I know, I said I would make a better parser a while back,
> I'm a lazy bum :-)

I think you are anything but lazy...:-)

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:
> 
> > The SQL->XML doesn't
> > work very well at all. I could only get it to work with a very small
> > number of SQL files I tried. I tried scarabs sql schema and it just
> > hangs there. I don't think that parser would work very well on
> > nasty Oracle SQL either.
> 
> Well, then we should fix it. I spent a lot of time re-writing it to work
> better with regards to bad .sql files and I'm sure there are still a few
> bugs in it, but I know that I got it to parse one hell of a huge .sql file
> that Helm was using...
> 
> Also, Jason, Town has a .sql parser done in javacc, maybe you can take that
> and create a better system...:-)

I know, I know, I said I would make a better parser a while back,
I'm a lazy bum :-)

> 
> -jon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 10:30 AM, "Jason van Zyl" <jv...@apache.org> wrote:

> The SQL->XML doesn't
> work very well at all. I could only get it to work with a very small
> number of SQL files I tried. I tried scarabs sql schema and it just
> hangs there. I don't think that parser would work very well on
> nasty Oracle SQL either.

Well, then we should fix it. I spent a lot of time re-writing it to work
better with regards to bad .sql files and I'm sure there are still a few
bugs in it, but I know that I got it to parse one hell of a huge .sql file
that Helm was using...

Also, Jason, Town has a .sql parser done in javacc, maybe you can take that
and create a better system...:-)

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Jon Stevens wrote:
> 
> on 4/20/01 3:46 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:
> 
> >> What might work better for you is the JDBC -> XML process. I looked
> >> at the code a couple minutes ago and I don't think it will work
> >> in its current state. You might want to try and fix that up and
> >> use that though it's probably not up-to-date WRT the XML schema
> >> it produces. It's on my list to fix but it's way at the bottom. If
> >> you're desperate I will take a look at it tonight.
> >
> > I've never heard of this before. It sounds great. I am trying to produce a
> > schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> > it by hand. ;)
> >
> > Thanks for your help.
> >
> > Gareth
> 
> No. Do not use the JDBC->XML process. Use the .sql->XML process. It works
> pretty well.

Why would you not recommend the JDBC->XML process? You just say
no, without qualification? I've always recommended the JDBC->XML
method because while not perfect it did generally work very well
because the proces is much simpler than trying to parse SQL. Trying
to parse all forms of SQL, especially with hand-written parser, is
a nightmare. If everything was SQL92 then maybe, but that's not
even close to true. At least with metadata there is some uniformity.

The SQL->XML doesn't
work very well at all. I could only get it to work with a very small
number of SQL files I tried. I tried scarabs sql schema and it just
hangs there. I don't think that parser would work very well on
nasty Oracle SQL either.

> 
> -jon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/20/01 3:46 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

>> What might work better for you is the JDBC -> XML process. I looked
>> at the code a couple minutes ago and I don't think it will work
>> in its current state. You might want to try and fix that up and
>> use that though it's probably not up-to-date WRT the XML schema
>> it produces. It's on my list to fix but it's way at the bottom. If
>> you're desperate I will take a look at it tonight.
> 
> I've never heard of this before. It sounds great. I am trying to produce a
> schema for aan Oracle database with over 20 tables. PLEASE don't make me do
> it by hand. ;)
> 
> Thanks for your help.
> 
> Gareth

No. Do not use the JDBC->XML process. Use the .sql->XML process. It works
pretty well.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
> I just fixed it in CVS so that it works. It is not at all forgiving
> with the SQL you throw at it but it might take you part of the way.
> I tried three sql files and only the simplest one worked.

I have an up-to-date CVS Jakarta-turbine module, but I still get the same
error. Maybe I'm not copying the right jar's into my TDK. (See my other
email)

> What might work better for you is the JDBC -> XML process. I looked
> at the code a couple minutes ago and I don't think it will work
> in its current state. You might want to try and fix that up and
> use that though it's probably not up-to-date WRT the XML schema
> it produces. It's on my list to fix but it's way at the bottom. If
> you're desperate I will take a look at it tonight.

I've never heard of this before. It sounds great. I am trying to produce a
schema for aan Oracle database with over 20 tables. PLEASE don't make me do
it by hand. ;)

Thanks for your help.

Gareth


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jason van Zyl <jv...@apache.org>.
Gareth Coltman wrote:
> 
> Good morning all(in the UK anyway).
> 
> Can someone tell me if it is normal for turbine to try and insert NULL into
> the primary key. Is this what happens using auto increment? I will continue
> to investigate but so far I cam completely unable to get Turbine to generate
> any kind of primary key. I can happily insert my own keys so the connection
> is fine...
> 
> More importantly is why the sql2xml task doesn't work. I have tried to run
> it on a W2K machine and get the following error:

I just fixed it in CVS so that it works. It is not at all forgiving
with the SQL you throw at it but it might take you part of the way.
I tried three sql files and only the simplest one worked.

What might work better for you is the JDBC -> XML process. I looked
at the code a couple minutes ago and I don't think it will work
in its current state. You might want to try and fix that up and
use that though it's probably not up-to-date WRT the XML schema
it produces. It's on my list to fix but it's way at the bottom. If
you're desperate I will take a look at it tonight.

> 
> build-project.xml:442: Could not create task of type: sql-xml. Common
> solutions are to use taskdef to declare your task, or, if this is an
> optional task, to put the optional.jar in the lib directory of your ant
> installation (ANT_HOME).
> 
> This is really important,as otherwise I am going to have to create the
> entire schema by hand.

You'll have to pull turbine out of CVS and build it if you want the
fixed
sql2xml ant task. It will be in the next TDK.
 
> Gareth
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: AGH! Oracle is painful

Posted by Gareth Coltman <ga...@majorband.co.uk>.
Good morning all(in the UK anyway).

Can someone tell me if it is normal for turbine to try and insert NULL into
the primary key. Is this what happens using auto increment? I will continue
to investigate but so far I cam completely unable to get Turbine to generate
any kind of primary key. I can happily insert my own keys so the connection
is fine...

More importantly is why the sql2xml task doesn't work. I have tried to run
it on a W2K machine and get the following error:

build-project.xml:442: Could not create task of type: sql-xml. Common
solutions are to use taskdef to declare your task, or, if this is an
optional task, to put the optional.jar in the lib directory of your ant
installation (ANT_HOME).

This is really important,as otherwise I am going to have to create the
entire schema by hand.

Gareth



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


AW: AGH! Oracle is painful

Posted by Holger Dehnhardt <de...@hw-edv.de>.
> 
> on 4/18/01 6:36 AM, "Gareth Coltman" 
> <ga...@majorband.co.uk> wrote:
> 
> > Man, this was soooo much easier with MySQL....
> 
> Just think...you paid a shit load of money for that pain. :-)
> 
> -jon
> 
Not even pain is for free ;-)

Holger 


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: AGH! Oracle is painful

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/18/01 6:36 AM, "Gareth Coltman" <ga...@majorband.co.uk> wrote:

> Man, this was soooo much easier with MySQL....

Just think...you paid a shit load of money for that pain. :-)

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org