Subject Re: Transactions
Author rrokytskyy
Hi,

In general - no, this is not possible in JDBC driver. Embedded SQL
Guide applies to C/C++ preprocessor (gpre), and converts all the stuff
you find there into API calls. So, named transaction, etc. are not
available in JDBC SQL.

> If you read the Interbase Embedded SQLGuide, you see it's possible to
> set transaction isolation level and other things like only allowing
> it to read.

This is available through java.sql.Connection interface. Also, you
have complete access to TPB (Transaction Parameters Block) through
FBWrappingDataSource class.

> Moreover there are lots of examples that use multipe transactions
> with names an everything. I believe all the examples are based in
> some preprocessor that allows you to put sql statements between C
> code, and it requires declaring the names as C pointers...

Multiple transactions per connection are available only when using API
directly (org.firebirdsql.gds.* and org.firebirdsql.jgds.* packages).

> Is ther a way to change the default behavior of the default
> transaction o to create multiple transactions per connection using
> Java?

Yes, you can go low level and use org.firebirdsql.jgds.GDS_Impl to
talk to database server directly. API is very similar to one described
in API Guide (it was adapted to Java, for example, if C code passes
pointer + length, we pass only array of bytes). This code was created
by Alejandro Alberola Arias and is the cornerstone of our driver.

Note, you can do this in Java, but not through JDBC interfaces. Also,
you cannot mix the code, you either go low-level and use API, or JDBC,
because JDBC driver will not provide you access to its DPB, TPB and
statement handles.

> does this require support from the Driver implementation? is it
> possible to call SET TRANSACTION READ ONLY;?

No, you cannot execute such statement. Use
Connection.setReadOnly(true) instead.


Best regards,
Roman Rokytskyy