Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

writing in oracle database with java

0 views
Skip to first unread message

Stefan Seidel

unread,
Aug 29, 2003, 8:13:44 PM8/29/03
to
Hi NG,

i'm trying to create tables and to insert data into these tables using
oracle.jdbc.

(first a "create table" statement and then couple of "insert into"
statements)

There are no problems except for the last table. The table is created but
the data is not inserted.

This happens regardless of if i create 3,4,5 etc. tables with the last
table.

what am i doing wrong?

Stefan


Daniel Morgan

unread,
Aug 29, 2003, 11:51:16 AM8/29/03
to
Stefan Seidel wrote:

Oracle version and edition?
Code sample?
JDBC driver being used?

Crystal ball is broken.

But I would advise you to not perform DDL on-the-fly. Tables should not be
built across a JDBC link as part of an application. Build them in SQL*Plus
and then leave them alone.
--
Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp
http://www.outreach.washington.edu/extinfo/certprog/aoa/aoa_main.asp
damo...@x.washington.edu
(replace 'x' with a 'u' to reply)


Stefan Seidel

unread,
Aug 29, 2003, 8:56:52 PM8/29/03
to
Sorry, thought it might be something typical...

Oralce Ver. 9.0.1
jdbc version: ojdbc 1.4

Code example:

for(int i = 0;i< hierarchie.size();i++){

// CREATE TABLE
tableName = "DWH.snowflake_dim_" + i;
statementString = "CREATE TABLE " +tableName +
"(ID INTEGER,UEBER INTEGER)";
statement.executeUpdate(statementString);
Vector ebene = (Vector)hierarchie.elementAt(i);

// INSERT INTO
for(int z = 0;z < ebene.size(); z++){
statementString = "INSERT INTO "+tableName+" VALUES ("+
((Eintrag)(ebene.elementAt(z))).id+","+
((Eintrag)(ebene.elementAt(z))).ueber+")";

statement.executeUpdate(statementString);
}


"Daniel Morgan" <damo...@exxesolutions.com> wrote in message
news:3F4F7674...@exxesolutions.com...

Rene Nyffenegger

unread,
Aug 29, 2003, 12:59:55 PM8/29/03
to


Stefan,

I'd say you forgot to commit the inserts. You see the other data because
create table does an implicit commit.

hth
Rene


--
Rene Nyffenegger
http://www.adp-gmbh.ch

Maximus

unread,
Aug 29, 2003, 6:08:44 PM8/29/03
to
"Stefan Seidel" <sse...@uni-muenster.de> wrote in message
news:bint5i$qla$1...@redenix.uni-muenster.de...

> Sorry, thought it might be something typical...
>
> Oralce Ver. 9.0.1
> jdbc version: ojdbc 1.4
>
> Code example:
>
> for(int i = 0;i< hierarchie.size();i++){
>
> // CREATE TABLE
> tableName = "DWH.snowflake_dim_" + i;
> statementString = "CREATE TABLE " +tableName +
> "(ID INTEGER,UEBER INTEGER)";
> statement.executeUpdate(statementString);
> Vector ebene = (Vector)hierarchie.elementAt(i);
>
> // INSERT INTO
> for(int z = 0;z < ebene.size(); z++){
> statementString = "INSERT INTO "+tableName+" VALUES ("+
> ((Eintrag)(ebene.elementAt(z))).id+","+
>
((Eintrag)(ebene.elementAt(z))).ueber+")";
>
> statement.executeUpdate(statementString);
> }

Where are the commits?


Jim Kennedy

unread,
Aug 29, 2003, 10:38:38 PM8/29/03
to
When he does the next create table statement. So maybe that is why he is
not seeing the last set of data, no commit. What is an uber integer?
Jim


"Maximus" <asdfa...@eqeqweqwe.com> wrote in message
news:M9Q3b.58367$la.11...@news1.calgary.shaw.ca...

Maximus

unread,
Aug 30, 2003, 1:18:32 AM8/30/03
to
"Jim Kennedy" <kennedy-down_with_spammers@no_spam.comcast.net> wrote in
message news:O6U3b.301799$YN5.207911@sccrnsc01...

> When he does the next create table statement. So maybe that is why he is
> not seeing the last set of data, no commit. What is an uber integer?
> Jim

Makes sense, "executeUpdate('COMMIT')" after the inserts should fix that.

ueber integer... sounds like German for above, over, super... probably a
foreign key to the parent/master?

Richard Kuhler

unread,
Sep 2, 2003, 8:16:21 PM9/2/03
to
Stefan Seidel wrote:
<snip>

> for(int i = 0;i< hierarchie.size();i++){
>
> // CREATE TABLE
> tableName = "DWH.snowflake_dim_" + i;
> statementString = "CREATE TABLE " +tableName +
> "(ID INTEGER,UEBER INTEGER)";
> statement.executeUpdate(statementString);
> Vector ebene = (Vector)hierarchie.elementAt(i);
>
> // INSERT INTO
> for(int z = 0;z < ebene.size(); z++){
> statementString = "INSERT INTO "+tableName+" VALUES ("+
> ((Eintrag)(ebene.elementAt(z))).id+","+
> ((Eintrag)(ebene.elementAt(z))).ueber+")";
>
> statement.executeUpdate(statementString);
> }
>
<snip>

I'd recommend you switch to using bind variables (set methods). If this
is a one time script you mike be ok without it but you're probably
scrambling the SGA pretty good here. As for the inserts missing, the
other posters are almost certainly right about the commit. Although,
since JDBC connections are auto-commit by default, this would assume
that you've changed it using the setAutoCommit method. That would seem
to indicate that you know about commits though and just didn't do it
here. Strange.


Richard Kuhler

0 new messages