Subject | Re: [Firebird-Java] Re: Big ResultSet |
---|---|
Author | Rick Fincher |
Post date | 2003-11-12T23:58:04Z |
Just write your own simple class that loads the driver and sets it up when
it's instantianted. Write a method for it called getCon, for example, that
returns a java.sql.Connection and takes as input an init string plus a
boolean to determine whether it is in autocommit mode or not.
When your getCon method gets a connection from the driver, it sets
autocommit on the connection using the boolean passed in, sets any other
parameters you like, then returns the connection.
You can hide all the driver specific stuff in here. That way you can change
drivers, database types and other details in one location without changing
the rest of your code.
You can even hide things like the usernme and password in here or details
like pooling parameters and even the suffix for the database file name.
This can also be helpful for a JSP if you want to distribute most of the JSP
in easily modifiable .jsp file format, but hide those database details from
the user by compiling your class and only distributing its .class file with
the web app. It's not fool proof but it does help limit access to that
info.
This is the kind of stuff OO languages like Java were designed for, so the
lack of a autocommit switch in getConnection is really a non-issue.
The code to do this is probably shorter than the paragraph above. Hope this
helps!
Rick
it's instantianted. Write a method for it called getCon, for example, that
returns a java.sql.Connection and takes as input an init string plus a
boolean to determine whether it is in autocommit mode or not.
When your getCon method gets a connection from the driver, it sets
autocommit on the connection using the boolean passed in, sets any other
parameters you like, then returns the connection.
You can hide all the driver specific stuff in here. That way you can change
drivers, database types and other details in one location without changing
the rest of your code.
You can even hide things like the usernme and password in here or details
like pooling parameters and even the suffix for the database file name.
This can also be helpful for a JSP if you want to distribute most of the JSP
in easily modifiable .jsp file format, but hide those database details from
the user by compiling your class and only distributing its .class file with
the web app. It's not fool proof but it does help limit access to that
info.
This is the kind of stuff OO languages like Java were designed for, so the
lack of a autocommit switch in getConnection is really a non-issue.
The code to do this is probably shorter than the paragraph above. Hope this
helps!
Rick
----- Original Message -----
>
> Just because it's much easier to specify at create time, rather than
having
> to create them and then set them all to false...think it would be good to
> allow other settings to be specified at connect time too.
>
> Cheers,
>
> David
>
> Just curious, why is it important for this to be in the connection
> string?
>
>
>
> Can we add this as a feature request? Believe it would be very
> helpful...
>
> Cheers,
>
> David
>
>
>
>
> "Roman Rokytskyy" <rrokytskyy@...> on 12/11/2003 03:52:12 AM
>
> Please respond to Firebird-Java@yahoogroups.com
>
> To: Firebird-Java@yahoogroups.com
> cc:
> Subject: [Firebird-Java] Re: Big ResultSet
>
>
> > Is there a way to create connections in my connection pool with
> > autocommit off? Or do I have to set it off for each one after they
> > are created? eg in SAP you can specify it in the connection
> > string...
>
> You have to set for each one after they are returned from pool. It is
> not possible to specify this behaviour in connection string.
>
> Roman