Thank you all for your pointers. I am well aware of the difficulty of
writing good documentatioin when you are an expert in the field; sometimes
ignorance is a blessing. I shall continue to report omissions or
ambiguities as I find them.

More documentation updates then....

I think that the docs always show things within a transaction, but don't
mention that you MUST be in a transaction. I will change table name to
class name and see how I get on. Again, this distinction is not clear from
the docs. However, what I do not understand is why I need to be in a
transaction when I call query.create(). Surely I should not need a
transaction until I actually execute the query?

Both count(*) and 'as' are in the OQL grammar I downloaded from ODMG.org
yesterday. The one is in 'aggregateExpr', the other in 'projection'. If, as
you say, the selection list (projectionAttributes in the grammar) is merely
a placeholder, then the aggregate functions of the grammar can never be
evaluated. Surely this was not the intention of the ODMG?


I have now run the tests. The transaction wrapping is not necesary; the
full class name is necessary; count(*) gives a syntax error.



|---------+--------------------------------->
|         |           "Brian McCallister"   |
|         |           <[EMAIL PROTECTED]|
|         |           ompany.com>           |
|         |                                 |
|         |                                 |
|         |           02-Apr-2004 14:27     |
|         |           Please respond to "OJB|
|         |           Users List"           |
|         |           <[EMAIL PROTECTED]|
|         |           g>                    |
|         |                                 |
|---------+--------------------------------->
  
>-------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |       To:      "OJB Users List" <[EMAIL PROTECTED]>                                
                                |
  |                                                                                    
                                     |
  |       cc:                                                                          
                                     |
  |       Subject: Re: Newbie (almost) at a standstill                                 
                                     |
  
>-------------------------------------------------------------------------------------------------------------------------|



Any chance you could sum up what needs improvement in the docs? As
Thomas put it when I first got involved with OJB, once you get really
close to it, it can be hard to see it from a newcomers perspective =(
There is a *lot* to it. I am personally invested in trying to make it
easy for people to get started with OJB (I did the getting started,
ojb-blank, and the new tutorials -- if they are deficient it is my
fault, so I appreciate any help in fixing em up =)

On ODMG:

I don't think count(*) is supported (anyone know about this? I don't
use ODMG much)). Last I used ODMG count, upper, etc weren't in it
(using the ODMG published grammar for OQL).

"as" isn't an OQL keyword. The "foo" in "select foo from bar" is pretty
much a placeholder that doesn't do anything, to my (limited) knowledge
of the ODMG OQL spec. In this case "foo" is just a label. What is
returned is specificed by the "from classname" section.

Looking at your test case, the NPE's are likely being caused by the
fact that you don't have a transaction in progress. The ODMG api
requires all queries etc be executed within the context of a
transaction:

To take some code from the ODMG tutorial:

     public static Product findProductByName(String name) throws
Exception
     {
         Implementation impl = OJB.getInstance();
         Transaction tx = impl.newTransaction();
         tx.begin();

         OQLQuery query = impl.newOQLQuery();
         query.create("select products from "
                      + Product.class.getName()
                      + " where name = $1");
         query.bind(name);
         DList results = (DList) query.execute();
         Product product = (Product) results.iterator().next();

         tx.commit();
         return product;
     }

Additionally, you need to include the full classname, including
package, in the OQL string. I don't know if your Entity class is in the
top level namespace, or in the same as the unit test, so I don't know
if this is part of what is happening or not.
-Brian

On Apr 2, 2004, at 8:02 AM, [EMAIL PROTECTED] wrote:

> So, apart from one glitch I think that the other points are matters of
> clearer documentation.
>
> It is not clear from the Getting Started doc just what one has to do
> and in
> what order. There are also inconsistencies betwen the default
> build.properties and *.profiles as towhich variables are required. Some
> tidying up is what it comes down to.
>
> I am just left with my ODMG problem.
>
>
> BTW for those who are a bit irritated by my not snipping out the
> older, and
> now irrelvant, parts of this message stream, I am working with Lotus
> Notes,
> and if I try to edit the message it just deletes the whole lot.
>
>
>
>
>
> |---------+--------------------------------->
> |         |           "Brian McCallister"   |
> |         |           <[EMAIL PROTECTED]|
> |         |           ompany.com>           |
> |         |                                 |
> |         |                                 |
> |         |           02-Apr-2004 13:10     |
> |         |           Please respond to "OJB|
> |         |           Users List"           |
> |         |           <[EMAIL PROTECTED]|
> |         |           g>                    |
> |         |                                 |
> |---------+--------------------------------->
>> ----------------------------------------------------------------------
>> ---------------------------------------------------|
>   |
>                                                      |
>   |
>                                                      |
>   |
>                                                      |
>   |       To:      "OJB Users List" <[EMAIL PROTECTED]>
>                                                      |
>   |
>                                                      |
>   |       cc:
>                                                      |
>   |       Subject: Re: Newbie (almost) at a standstill
>                                                      |
>> ----------------------------------------------------------------------
>> ---------------------------------------------------|
>
>
>
> repository.xml wasn't copied in rc5, was a problem, has been fixed in
> rc6. If you want to patch manually, change the ant copy in build.xml to
> copy respositor*.xml instead of repository_*.xml =)
>
> DB profiles are not copied on purpose, you need to copy the relevant
> settings into build.properties yourself. The build.properties contains
> all of the variables -- including jcdAlias and jdbcRuntimeDriver (in
> build.properties they are "default" and "org.hsqldb.jdbcDriver"
> respectively). You can C&P the properties out of profiles if you want
> to. I deemed that copying all the profiles over was overkill as
> ojb-blank is supposed to try to be minimal to help people get started.
>
> The setting of the variables in repositor*.xml is done via ant property
> substitution from the values in build.properties.
>
> -Brian
>
> On Apr 2, 2004, at 6:19 AM, [EMAIL PROTECTED] wrote:
>
>> A status report on my problems.
>>
>> I went back to square one and managed to get things to work. However,
>> in
>> the  process I found some glitches. Maybe they are finger trouble on
>> my
>> part, maybe they are omissions in the code or the documentation.
>>
>>
>> 1.    The variable ${jcdAlias} is used in repository_database.xml, but
>> nothing sets it. I also cannot find where it is picked up from.
>> 2.    Repository.xml is not included in obj-blank.jar
>> 3.    The various DB profiles are not included in ojb-blank.jar
>> 4.    JdbcRuntimeDriver has to be added to build.properties before
>> doing
>> the ant build step.
>>
>> I now have PB working, but I cannot get ODMG to work. I am using rc5
>> and
>> keep getting NPEs from query.create(), sometimes with associated
>> syntax
>> 'errors'. My table already exists and contains about 6M rows. The
>> code,
>> which is intended merely to verify basic connectivity, is below
>>
>>
>> select betid from Entity          => NPE with no other diagnostic
>> select count(*) from Entity     => NPE with 'unxexpected token "("
>> found,
>> expected "from"'
>> select betid as b from entity   => NPE with 'unexpected token "as"
>> ...'
>> select betid b from Entity       => NPE with 'unexpected token "b"
>> ...'
>>
>> /*
>>  * Created on 31-Mar-04
>>  * CVS version $Header:$
>>  */
>> package com.gsk;
>>
>> import junit.framework.TestCase;
>>
>> import org.apache.ojb.broker.PersistenceBroker;
>> import org.apache.ojb.broker.PersistenceBrokerFactory;
>> import org.apache.ojb.broker.query.Criteria;
>> import org.apache.ojb.broker.query.Query;
>> import org.apache.ojb.broker.query.QueryByCriteria;
>> import org.apache.ojb.odmg.OJB;
>> import org.odmg.Database;
>> import org.odmg.Implementation;
>> import org.odmg.OQLQuery;
>>
>> /**
>>  * @author rxm1676
>>  * @company GSK
>>  */
>> public class EntityTest extends TestCase {
>>       PersistenceBroker broker = null;
>>       Implementation odmg = null;
>>       Database db = null;
>>       /**
>>        * Constructor for EntityTest.
>>        * @param arg0
>>        */
>>       public EntityTest(String arg0) {
>>             super(arg0);
>>       }
>>
>>       /*
>>        * @see TestCase#setUp()
>>        */
>>       protected void setUp() throws Exception {
>>             super.setUp();
>>             broker =
>> PersistenceBrokerFactory.defaultPersistenceBroker();
>>             odmg = OJB.getInstance();
>>             db   = odmg.newDatabase();
>>             db.open("default", Database.OPEN_READ_WRITE);
>>       }
>>
>>       /*
>>        * @see TestCase#tearDown()
>>        */
>>       protected void tearDown() throws Exception {
>>             super.tearDown();
>>             if (broker != null) {
>>                   broker.close();
>>                   broker = null;
>>             }
>>             if (db != null) {
>>                   db.close();
>>                   db = null;
>>             }
>>       }
>>
>> /**
>>  * Establishes a connection to the DB and counts the number
>>  * of items in the Entity table using the PB
>>  *
>>  */
>> public void estPBConnection()
>> {
>>       Criteria c = new Criteria();
>>       Query q = new QueryByCriteria(Entity.class, c);
>>       int count = broker.getCount(q);
>>       System.out.println("Count: "+String.valueOf(count));
>> }
>>
>> /**
>>  * Basic test on the ODMG interface.
>>  *
>>  */
>> public void testODMG()
>> {
>>       try {
>>             OQLQuery query = odmg.newOQLQuery();
>>             if (query==null) {
>>                   System.err.println("newOQLQuery() returned null");
>>                   fail();
>>             }
>>             query.create("select betid from Entity where betid<5");
>>             Object obj = query.execute();
>>             System.out.println("Class of the result is
>> "+obj.getClass());
>>       } catch (Exception e) {
>>             System.err.println("Caught exception"+e);
>>             e.printStackTrace();
>>             fail();
>>       }
>>
>> }
>> }
>>
>>
>>
>>
>> |---------+---------------------------->
>> |         |           "Armin Waibel"   |
>> |         |           <[EMAIL PROTECTED]|
>> |         |           g>               |
>> |         |                            |
>> |         |                            |
>> |         |           30-Mar-2004 11:18|
>> |         |           Please respond to|
>> |         |           "OJB Users List" |
>> |         |           <[EMAIL PROTECTED]|
>> |         |           he.org>          |
>> |         |                            |
>> |---------+---------------------------->
>>> ---------------------------------------------------------------------
>>> -
>>> ---------------------------------------------------|
>>   |
>>                                                      |
>>   |
>>                                                      |
>>   |
>>                                                      |
>>   |       To:      "OJB Users List" <[EMAIL PROTECTED]>
>>                                                      |
>>   |
>>                                                      |
>>   |       cc:
>>                                                      |
>>   |       Subject: Re: Newbie at a standstill
>>                                                      |
>>> ---------------------------------------------------------------------
>>> -
>>> ---------------------------------------------------|
>>
>>
>>
>> Hi Raphael,
>>
>> from your stack trace I can see you manipulate many of the default
>> jdbc
>> settings:
>>
>> Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could
>> not
>>> borrow connection from pool -
>>> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
>>> [EMAIL PROTECTED]
>>>   jcd-alias=BETConnection
>>>   default-connection=true
>>>   dbms=oracle
>>>   jdbc-level=2.0
>>>   driver=oracle.jdbc.driver.OracleDriver
>>>   protocol=jdbc
>>>   sub-protocol=oracle:thin
>>>   [EMAIL PROTECTED]:1521:TOOLS
>>>   user=bet
>>>   password=*****
>>>   eager-release=true
>>
>> only set true in JBoss <3.2.2 (but recommended to use 3.2.2 or higher)
>>
>>
>>>   ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a
>>> query,
>>
>> OJB try to perform a validation query "a query", this will fail (not
>> SQL
>> compatible ;-)). Maybe this is the problem you have.
>>
>>
>>> maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true,
>>> numTestsPerEvictionRun=5, testWhileIdle=true,
>>> minEvictableIdleTimeMillis=4,
>>> testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8,
>>> timeBetweenEvictionRunsMillis=6, testOnBorrow=true}
>>
>> again, I recommend to use default settings first and only change
>> settings step by step.
>>
>>
>>>   batchMode=true
>>
>> I recommend to set batch-mode false to avoid side-effects. You can try
>> to enable it when all stuff is working fine.
>>
>>
>>>   useAutoCommit=AUTO_COMMIT_IGNORE_STATE
>>
>> Again default is '1', you set '0'. But in managed enviroments you need
>> to set '0'. Do you try to run OJB in a managed environment? This
>> wouldn't be a good starting point for a newbie ;-)
>>
>> ahh, now I see in your repository_database.xml what you have done. You
>> picked up a jdbc-connection-descriptor used for junit testing and set
>> you DB properties. This will not work, because the used properties
>> don't
>> be valid.
>>
>> Did you see
>>
>> http://db.apache.org/ojb/getting-started.html
>>
>> http://db.apache.org/ojb/platforms.html
>>
>> As Brian said before, recommended to use this way first to setup your
>> environment. In build.properties you can set your DB. In the profiles
>> directory you can find "templates" for all supported databases. Pick
>> the
>> oracle file and set your properties.
>>
>> regards,
>> Armin
>>
>>>   ignoreAutoCommitExceptions=true
>>
>> [EMAIL PROTECTED] wrote:
>>> I have done the 'ant build' and it makes no difference. If in the
>>> db.open
>> ()
>>> I change to the "default" db alias the system appears not to see my
>>> parameters at all. It has username and password set to null. There is
>>> clearly something terribly obvious that I am just not understanding
>>> about
>>> setting up OJB.
>>>
>>> [org.apache.ojb.odmg.DatabaseImpl] ERROR: Open database failed:
>>> Borrow
>>> broker from pool failed, using PBKey org.apache.ojb.broker.PBKey:
>>> jcdAlias=default, user=null, password=null
>>> Borrow broker from pool failed, using PBKey
>>> org.apache.ojb.broker.PBKey:
>>> jcdAlias=default, user=null, password=null
>>> org.apache.ojb.broker.PBFactoryException: Borrow broker from pool
>>> failed,
>>> using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=null,
>>> password=null
>>>       at
>>>
>> org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createP
>> e
>> rsistenceBroker(Unknown
>>
>>>
>>> Source)
>>>       at
>>>
>> org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker
>> (
>> Unknown
>>
>>>
>>> Source)
>>>       at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
>>>       at com.gsk.bet.ConnectionTest.setUp(ConnectionTest.java:33)
>>>
>>> As a background, I should explain that I am reasonably familiar with
>>> Torque. I am in the process of evaluating whether to go with OJB,
>>> which
>>> seems on paper to have some advantages over Torque, or whether to use
>>> Torque also for this project. I really want database independence, so
>>> I
>>> would prefer to use OJB.
>>>
>>>
>>>
>>>
>>>
>>> |---------+--------------------------------->
>>> |         |           "Brian McCallister"   |
>>> |         |           <[EMAIL PROTECTED]|
>>> |         |           ompany.com>           |
>>> |         |                                 |
>>> |         |                                 |
>>> |         |           29-Mar-2004 17:34     |
>>> |         |           Please respond to "OJB|
>>> |         |           Users List"           |
>>> |         |           <[EMAIL PROTECTED]|
>>> |         |           g>                    |
>>> |         |                                 |
>>> |---------+--------------------------------->
>>>>
>> ----------------------------------------------------------------------
>> -
>> --------------------------------------------------|
>>
>>>   |
>> |
>>>   |
>> |
>>>   |
>> |
>>>   |       To:      "OJB Users List" <[EMAIL PROTECTED]>
>> |
>>>   |
>> |
>>>   |       cc:
>> |
>>>   |       Subject: Re: Newbie at a standstill
>> |
>>>>
>> ----------------------------------------------------------------------
>> -
>> --------------------------------------------------|
>>
>>>
>>>
>>>
>>> Are you using the ant build? The ojb-blank project template does a
>>> property replace in the build -- the required database information is
>>> in the build.properties and is copied into the generated
>>> repository_database.xml that goes in build/ when compilation is run.
>>>
>>> -Brian
>>>
>>> On Mar 29, 2004, at 11:24 AM, [EMAIL PROTECTED] wrote:
>>>
>>>
>>>> I am trying to get OJB working and am getting absolutely nowhere, so
>>>> I
>>>> appeal to the list for some help.
>>>>
>>>> The environment is OJB rc5, Eclipse IDE, Sun JDK1.4.2, Oracle 9,
>>>> NT4.0. The
>>>> running of the code is controlled by JUnit.
>>>>
>>>> I can connect to the DB both with sqlplus and jdbc. I cannot
>>>> actually
>>>> get
>>>> OJB to connect. Clearly I am missing something, but I cannot
>>>> discover
>>>> what.
>>>> By fiddling around  with the XML I can generate various sorts of
>>>> errors. In
>>>> all cases the url that the system is using appears to be entirely
>>>> palusible.
>>>>
>>>> Here are the code, the repository_database.xml and the output:
>>>>
>>>> Code:
>>>>
>>>> /*
>>>> * Created on 26-Mar-2004
>>>> * CVS version $Header:$
>>>> */
>>>> package com.gsk.bet;
>>>>
>>>> import java.util.*;
>>>> import java.sql.*;
>>>> import junit.framework.*;
>>>> import org.apache.ojb.broker.*;
>>>> import org.apache.ojb.broker.query.*;
>>>> import org.odmg.*;
>>>> import org.apache.ojb.odmg.*;
>>>> import com.gsk.bet.Entity;
>>>> /**
>>>> * @author rxm1676
>>>> * @company GSK
>>>> */
>>>> public class ConnectionTest extends TestCase {
>>>>      PersistenceBroker broker;
>>>>      Database db = null;
>>>>      Implementation odmg = null;
>>>>
>>>>      public void setUp() {
>>>>
>>>>            try {
>>>>                  Class c =
>>>> Class.forName("oracle.jdbc.driver.OracleDriver"
>>>> );
>>>>                  broker =
>>>> PersistenceBrokerFactory.defaultPersistenceBroker();
>>>>                  odmg = OJB.getInstance();
>>>>                  db = odmg.newDatabase();
>>>>                  db.open("BETConnection", Database.OPEN_READ_WRITE);
>>>>            } catch (Exception ex) {
>>>>                  System.out.println(ex);
>>>>            }
>>>>
>>>>      }
>>>>
>>>>      public void tearDown() {
>>>>            if (broker != null) {
>>>>                  broker.close();
>>>>            }
>>>>            if (db != null) {
>>>>                  try {
>>>>                        db.close();
>>>>                  } catch (ODMGException ex2) {
>>>>                  }
>>>>            }
>>>>
>>>>      }
>>>>
>>>>      /**
>>>>       * Null test. Just checks that OJB is properly installed, that
>>>> it can
>>>> see both the
>>>>       * XML and the bean classes, and that we can get a Broker and
>>>> an
>>>> ODMG
>>>> instance.
>>>>       *
>>>>       */
>>>>      public void testConnection() {
>>>>      }
>>>>
>>>>
>>>> /**
>>>> * Ensure that we can actually talk to the DB from this machine
>>>> *
>>>> */
>>>> public void testRawJDBC()
>>>> {
>>>>   try {
>>>>      Connection con = DriverManager.getConnection
>>>>      ("jdbc:oracle:thin:@ukt01368.ggr.co.uk:1521:TOOLS", "bet",
>>>> "xxxx");
>>>>      PreparedStatement sth = con.prepareStatement("select * from
>>>> entity
>>>> where betid<10");
>>>>      ResultSet res = sth.executeQuery();
>>>>      System.out.println("Excuted raw query");
>>>>      while (res.next()) {
>>>>            Entity ent = new Entity();
>>>>            ent.setBetid(res.getInt("BETID"));
>>>>            ent.setEntityType(res.getString("ENTITYTYPE"));
>>>>            ent.setDescriptor(res.getString("DESCRIPTOR"));
>>>>            System.out.println("raw retrieval of "+ent);
>>>>      }
>>>>      res.close();
>>>>      con.close();
>>>>   } catch (Exception e) {
>>>>      System.out.println("Caught raw exception " + e);
>>>>  }
>>>> }
>>>>      /**
>>>>       *
>>>>       * @author rxm1676
>>>>       * @company GSK
>>>>       */
>>>>      public void testODMGFetchSingle() {
>>>>            Transaction tx = odmg.newTransaction();
>>>>            try {
>>>>
>>>>                  OQLQuery query = odmg.newOQLQuery();
>>>>                  query.create(
>>>>                        "select betid, entityType, descriptor from "
>>>> +
>>>>                        Entity.class.getName() + " where betid = 1");
>>>>                  DList results = (DList)query.execute();
>>>>                  for (Iterator iter = results.iterator();
>>>> iter.hasNext();)
>>>> {
>>>>                        tx.begin();
>>>>                        Entity res = (Entity)iter.next();
>>>>                        System.out.println("Retrieved " + res);
>>>>                        tx.commit();
>>>>                  }
>>>>            } catch (QueryInvalidException qie) {
>>>>                  System.out.println(qie);
>>>>                  tx.abort();
>>>>            } catch (QueryException qe) {
>>>>                  System.out.println(qe);
>>>>                  tx.abort();
>>>>            }
>>>>
>>>>      }
>>>>
>>>>      /**
>>>>       * Retrieve a single object using the PersistenceBroker
>>>>       * @author rxm1676
>>>>       * @company GSK
>>>>       */
>>>>      public void testPBFetchSingle()
>>>>      {
>>>>            Entity example = new Entity();
>>>>            example.setBetid(1);
>>>>            Query  q = QueryFactory.newQueryByExample(example);
>>>>            Entity res = (Entity)broker.getObjectByQuery(q);
>>>>            System.out.println("PB fetched "+res);
>>>>      }
>>>> }
>>>>
>>>> Database_repopsitory.xml
>>>>
>>>> <!-- @version $Id: repository_database.xml,v 1.17 2003/11/27  
>>>>
16:42:12
>>>>
>>>
>>> arminw Exp $ -->
>>>
>>>> <!--
>>>> Define here all used connections.
>>>> One defined connection should be defined as the default one,
>>>> by set default-connection="true" - this could be done at runtime
>>>> too.
>>>>
>>>> It is possible to set user/password at
>>>> runtime or let login different users at runtime using the same
>>>> database. Use different PBKey with same jcdAlias name but
>>>> different user/password.
>>>>
>>>> Ditto it is possible to add jdbc-connection-descriptor at runtime
>>>> using the MetadataManager.
>>>> -->
>>>>
>>>>    <!-- this connection was used as the default one within OJB -->
>>>>    <jdbc-connection-descriptor
>>>>            jcd-alias="@JCD_ALIAS@"
>>>>            default-connection="false"
>>>>            platform="@DBMS_NAME@"
>>>>            jdbc-level="@JDBC_LEVEL@"
>>>>            driver="@DRIVER_NAME@"
>>>>            protocol="@URL_PROTOCOL@"
>>>>            subprotocol="@URL_SUBPROTOCOL@"
>>>>            dbalias="@URL_DBALIAS@"
>>>>            username="@USER_NAME@"
>>>>            password="@USER_PASSWD@"
>>>>        eager-release="false"
>>>>            batch-mode="false"
>>>>        useAutoCommit="1"
>>>>        ignoreAutoCommitExceptions="false"
>>>>
>>>>        <connection-pool
>>>>            maxActive="21"
>>>>            validationQuery="" />
>>>>
>>>>        <sequence-manager className
>>>> ="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
>>>>            <attribute attribute-name="grabSize"
>>>> attribute-value="20"/>
>>>>            <attribute attribute-name="autoNaming"
>>>> attribute-value="true"/>
>>>>            <attribute attribute-name="globalSequenceId"
>>>> attribute-value
>>>> ="false"/>
>>>>            <attribute attribute-name="globalSequenceStart"
>>>> attribute-value
>>>> ="10000"/>
>>>>        </sequence-manager>
>>>>   </jdbc-connection-descriptor>
>>>>
>>>>   <!-- Datasource example -->
>>>>    <!-- jdbc-connection-descriptor
>>>>        jcd-alias="default"
>>>>
>>>
>>>
>> default-connection="false"
>>>
>>>>            platform
="Hsqldb"
>>>>
>>>
>>>
>> jdbc-level="2.0"
>>>
>>>>
jndi-datasource-name="
> java:DefaultDS"
>>>>
>>>
>>> username="sa"
>>>
>>>>            password=""
>>>>
> eager-release
>> ="false"
>>>>
batch-mode="false"
>>>>
> useAutoCommit="0"
>>>>
>>>
>>>
>>
ignoreAutoCommitExceptions="false"
>>>
>>>>
> <sequence-manager className
>>>>
> ="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
>>>>
>>>
>>
> <attribute attribute-name="autoNaming"
>>>
>>>>
attribute-value="true"/>
>>>>
>>>
>> </sequence-manager>
>>>
>>>>
</jdbc-connection-descriptor -->
>>>>
>>>>
>>>>
>>>>    <!--
>>>>        NOTE: This is a test descriptor used within
>>>>        the junit test suite, do not change any value.
>>>>        A test db connections used for junit tests.
>>>>        This connection matches a hsql database called 'OJB_FarAway'
>>>>        If you do not use the test suite, you could delete
>>>>        this descriptor.
>>>>        This descriptor was used to check multiple database
>>>>        use.
>>>>    -->
>>>>    <jdbc-connection-descriptor
>>>>        jcd-alias="farAway"
>>>>        platform="Hsqldb"
>>>>        jdbc-level="2.0"
>>>>        driver="org.hsqldb.jdbcDriver"
>>>>        protocol="jdbc"
>>>>        subprotocol="hsqldb"
>>>>        dbalias="../OJB_FarAway"
>>>>        username="sa"
>>>>        password=""
>>>>        batch-mode="false"
>>>>
>>>>        <connection-pool
>>>>            maxActive="6"
>>>>            whenExhaustedAction="0"
>>>>            validationQuery="select count(*) from OJB_HL_SEQ"
>>>>        />
>>>>
>>>>        <sequence-manager className
>>>> ="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
>>>>            <attribute attribute-name="grabSize"
>>>> attribute-value="5"/>
>>>>        </sequence-manager>
>>>>    </jdbc-connection-descriptor>
>>>>
>>>>    <!--
>>>>        NOTE: This is a test descriptor used within
>>>>        the junit test suite, do not change any value.
>>>>        If you do not use the test suite, you could
>>>>        delete this descriptor.
>>>>        In the the test directory under
>>>>
>>>> org.apache.ojb.broker.metadata.MetadataTest#testReadConnectionDescri
>>>> p
>>>> to
>>>> r
>>>>        this descriptor will be evaluated.
>>>>    -->
>>>>    <jdbc-connection-descriptor
>>>>        jcd-alias="BETConnection"
>>>>        default-connection="true"
>>>>        platform="oracle"
>>>>        jdbc-level="2.0"
>>>>        driver="oracle.jdbc.driver.OracleDriver"
>>>>        protocol="jdbc"
>>>>        subprotocol="oracle:thin"
>>>>        dbalias="@ukt01368.ggr.co.uk:1521:TOOLS"
>>>>        username="bet"
>>>>        password="xxxx"
>>>>        eager-release="true"
>>>>        batch-mode="true"
>>>>        useAutoCommit="0"
>>>>        ignoreAutoCommitExceptions="true"
>>>>
>>>>        <object-cache class
>>>> ="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl">
>>>>            <attribute attribute-name="cacheKey1" attribute-value
>>>> ="cacheValue1"/>
>>>>            <attribute attribute-name="cacheKey2" attribute-value
>>>> ="cacheValue2"/>
>>>>        </object-cache>
>>>>
>>>>        <connection-pool
>>>>            maxActive="1"
>>>>            maxIdle="2"
>>>>            maxWait="3"
>>>>            minEvictableIdleTimeMillis="4"
>>>>            numTestsPerEvictionRun="5"
>>>>            testOnBorrow="true"
>>>>            testOnReturn="true"
>>>>            testWhileIdle="true"
>>>>            timeBetweenEvictionRunsMillis="6"
>>>>            whenExhaustedAction="2"
>>>>            validationQuery="a query"
>>>>            logAbandoned="true"
>>>>            removeAbandoned="true"
>>>>            removeAbandonedTimeout="8"
>>>>        />
>>>>
>>>>        <sequence-manager className
>>>> ="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
>>>>            <attribute attribute-name="key1"
>>>> attribute-value="value1"/>
>>>>            <attribute attribute-name="key2"
>>>> attribute-value="value2"/>
>>>>        </sequence-manager>
>>>>    </jdbc-connection-descriptor>
>>>>
>>>>
>>>> Output:
>>>>
>>>> Excuted raw query
>>>> raw retrieval of BET ID: 1 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 2 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 3 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 4 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 5 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 6 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 7 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 8 EntityType: Protein Descriptor;null
>>>> raw retrieval of BET ID: 9 EntityType: Protein Descriptor;null
>>>> [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR:
>>>> PersistenceBrokerException during the execution of the query: Used
>>>> ConnectionManager instance could not obtain a connection
>>>> Used ConnectionManager instance could not obtain a connection
>>>> org.apache.ojb.broker.PersistenceBrokerException: Used
>>>> ConnectionManager
>>>> instance could not obtain a connection
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatem
>>>> e
>>>> nt
>>>> (Unknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknow
>>>> n
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
>>>> Source)
>>>>      at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
>>>> Source)
>>>>      at

>>>> org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Un
>>>> k
>>>> no
>>>> wn
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQu
>>>> e
>>>> ry
>>>> (Unknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuer
>>>> y
>>>> (U
>>>> nknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Un
>>>> k
>>>> no
>>>> wn
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQu
>>>> e
>>>> ry
>>>> (Unknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQu
>>>> e
>>>> ry
>>>> (Unknown
>>>>
>>>> Source)
>>>>      at
>>>> com.gsk.bet.ConnectionTest.testPBFetchSingle(ConnectionTest.java:
>>>> 127)
>>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>      at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
>>>> .
>>>> ja
>>>> va:39)
>>>>      at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
>>>> s
>>>> so
>>>> rImpl.java:25)
>>>>      at java.lang.reflect.Method.invoke(Method.java:324)
>>>>      at junit.framework.TestCase.runTest(TestCase.java:154)
>>>>      at junit.framework.TestCase.runBare(TestCase.java:127)
>>>>      at junit.framework.TestResult$1.protect(TestResult.java:106)
>>>>      at junit.framework.TestResult.runProtected(TestResult.java:124)
>>>>      at junit.framework.TestResult.run(TestResult.java:109)
>>>>      at junit.framework.TestCase.run(TestCase.java:118)
>>>>      at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>>>      at junit.framework.TestSuite.run(TestSuite.java:203)
>>>>      at
>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remo
>>>> t
>>>> eT
>>>> estRunner.java:392)
>>>>      at
>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTes
>>>> t
>>>> Ru
>>>> nner.java:276)
>>>>      at
>>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTe
>>>> s
>>>> tR
>>>> unner.java:167)
>>>> Caused by: org.apache.ojb.broker.accesslayer.LookupException: Could
>>>> not
>>>> borrow connection from pool -
>>>> org.apache.ojb.broker.metadata.JdbcConnectionDescriptor:
>>>> [EMAIL PROTECTED]
>>>>  jcd-alias=BETConnection
>>>>  default-connection=true
>>>>  dbms=oracle
>>>>  jdbc-level=2.0
>>>>  driver=oracle.jdbc.driver.OracleDriver
>>>>  protocol=jdbc
>>>>  sub-protocol=oracle:thin
>>>>  [EMAIL PROTECTED]:1521:TOOLS
>>>>  user=bet
>>>>  password=*****
>>>>  eager-release=true
>>>>  ConnectionPoolDescriptor={whenExhaustedAction=2, validationQuery=a
>>>> query,
>>>> maxIdle=2, maxActive=1, maxWait=3, removeAbandoned=true,
>>>> numTestsPerEvictionRun=5, testWhileIdle=true,
>>>> minEvictableIdleTimeMillis=4,
>>>> testOnReturn=true, logAbandoned=true, removeAbandonedTimeout=8,
>>>> timeBetweenEvictionRunsMillis=6, testOnBorrow=true}
>>>>  batchMode=true
>>>>  useAutoCommit=AUTO_COMMIT_IGNORE_STATE
>>>>  ignoreAutoCommitExceptions=true
>>>>
>>>> sequenceDescriptor=org.apache.ojb.broker.metadata.SequenceDescriptor
>>>> @
>>>> 1e
>>>> 3118a
>>>>
>>>>
>>>>     sequenceManagerClass=class
>>>> org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl
>>>>     Properties={key2=value2, key1=value1}
>>>> ]
>>>> ]
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getCon
>>>> n
>>>> ec
>>>> tionFromPool(Unknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.look
>>>> u
>>>> pC
>>>> onnection(Unknown
>>>>
>>>> Source)
>>>>      at
>>>> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnectio
>>>> n
>>>> (U
>>>> nknown
>>>>
>>>> Source)
>>>>      ... 26 more
>>>> Caused by: java.util.NoSuchElementException: Could not create a
>>>> validated
>>>> object
>>>>      at
>>>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericO
>>>> b
>>>> je
>>>> ctPool.java:851)
>>>>      ... 29 more
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> -
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to