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
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)
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...
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
Where are the commits?
"Maximus" <asdfa...@eqeqweqwe.com> wrote in message
news:M9Q3b.58367$la.11...@news1.calgary.shaw.ca...
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?
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