Re: Using Cayenne and Firebird embeded JDBC driver

From: Nenko Ivanov (nivano..cygen.com)
Date: Fri Feb 27 2004 - 04:46:25 EST

  • Next message: Andrus Adamchik: "Re: Recovery from Network error"

    Thank you so much for your help. Now everything works fine for me.
    Regards Nenko Ivanov.

    ----- Original Message -----
    From: "Andrus Adamchik" <andru..bjectstyle.org>
    To: "Nenko Ivanov" <nenk..cygen.com>
    Sent: Thursday, February 26, 2004 7:06 PM
    Subject: Re: Using Cayenne and Firebird embeded JDBC driver

    > From the code below, I can tell that you want to use Firebird-specific
    > DataSource (note that DataSource is a factory of Connections, not a
    > Connection by itself). If you have a reason for doing that instead of
    > relying on Cayenne DataSource, you can write your own DataSourceFactory
    > implementation:
    >
    > http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    > conf/DataSourceFactory.html
    >
    > Then you can simply type your factory class name in the DataNode
    > "DataSource Factory" field. Cayenne makes no assumptions on how to pass
    > parameters to such custom factory, so it is up to you to decide on a
    > mechanism. E.g. you can have a property file loaded from somewhere, or
    > use System properties.
    >
    > Hope this helps.
    >
    > Andrus
    >
    >
    > On Feb 25, 2004, at 6:16 PM, Nenko Ivanov wrote:
    > > Hi :)
    > > So embeded firebird driver means that I connect to firebird database
    > > with
    > > running firebird server. There are 3 Windows DLL files that must be
    > > registered in Java application (the source below descrive it but it's
    > > not
    > > full and old but I have it at the moment I answer this post, and if
    > > someone
    > > is interested i can be more specific ) and my application use this
    > > ebeded
    > > firebird driver to connect and use all implemented JDBC functions
    > > without
    > > Firebird server installed on the application PC or available network
    > > (Java
    > > application uses 3 dlls).
    > > So I can use Cayenne with running Firebird server and everything is
    > > fine but
    > > I want to use the feature of embeded firebird driver.
    > > Tommorow I will be able to explain more clear my situation maybe :)
    > > Thanks for the answer and in advance for your future responce.
    > > Regards Nenko Ivanov.
    > >
    > > ---- CODE FOLLOWS // obtainint JDBS Connection object
    > > public void openConnection() {
    > > if (!FBDriverLoaded) { // don't load JayBird more than once.
    > > try {
    > > fbwds = new org.firebirdsql.jdbc.FBWrappingDataSource();
    > > FBDriverLoaded = true;
    > > System.out.println("Driver is loaded");
    > > fbwds.setDatabase(Constants.dbName);// Path name in string
    > > to FDB
    > > file for example c:\\database\\file.fdb
    > > fbwds.setUserName(Constants.userName);// sysdba
    > > fbwds.setPassword(Constants.pass);// masterkey
    > > }
    > > catch (ResourceException e) {
    > > System.out.println(
    > > "Could Not create
    > > org.firebirdsql.jdbc.FBWrappingDataSource,
    > > error:" +
    > > e + "n");
    > > }
    > >
    > > System.out.println("DEBUG (dbname) -> " + Constants.dbName);
    > > fbwds.setIdleTimeoutMinutes(30);
    > > fbwds.setPooling(true); // this turns on pooling for this data
    > > source. Max and min must be set.
    > > fbwds.setMinSize(2); // this sets the minimum number of
    > > connections
    > > to keep in the pool
    > > fbwds.setMaxSize(5); // this sets the maximum number of
    > > connections
    > > that can be open at one time.
    > > }
    > > try {
    > > fbwds.setLoginTimeout(10);
    > > }
    > > catch (SQLException e) {
    > > System.out.println("Could not set Login Timeout in
    > > SQLDrivern");
    > > }
    > >
    > > PS. There are some more specific parameters that are useful for more
    > > specific bussness needs.
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Feb 27 2004 - 04:48:01 EST