Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: writing in oracle database with java

Re: writing in oracle database with java

From: Richard Kuhler <noone_at_nowhere.com>
Date: Wed, 03 Sep 2003 00:16:21 GMT
Message-ID: <ppa5b.13366$gt1.470499@twister.socal.rr.com>


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 Received on Tue Sep 02 2003 - 19:16:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US