db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: Multiple SQL statements in a script fail using JDBC
Date Wed, 25 May 2005 07:39:02 GMT
>>>>>>>>>>>> Andrew wrote (2005-05-24 11:23:07):
> [snip]
> How can I give Derby a list of SQL statements from a script and it will 
> execute them, other than me parsing out SQL statement one prior to 
> calling the statement.execute().

>From JDBC you can't. You have either to execute the statements one by
one, or use the batch, but still tou have to add the statements one by
one to the batch (statement.addBatch() and statement.executeBatch()).

> I would like the database creation to be embedded into this Java 
> application.  Is there a utility to execute these scripts using a Java 
> Connection Object?

Not through a connection object. You can, however, consider using the
tool ij to execute a script of SQL statements.

> Also, what is the Derby SQL term used to COMMIT a transaction, it is not 
> "COMMIT"

In JDBC: connection.commit();
In ij: COMMIT;

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Mime
View raw message