Hi Mauricio,

seems that your jcd is not marked as "default" connection. Did you tried to do
// other steps
....
// merge new connection metadata with existing one
mm.mergeConnectionRepository(cr);
//mm.setDefaultPBKey(new PBKey("postgreSQL", "gsf", "gsf"))
// should work too
//mm.setDefaultPBKey(new PBKey("postgreSQL"))
...


or avoid the use of
PersistenceBrokerFactory.defaultPersistenceBroker()
method.

regards,
Armin

Mauricio Montblanch wrote:
Hi want to use a runtime conection, but OJB never takes the ne data as valid


this is the metadata I am using in the file bases.txt:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE descriptor-repository SYSTEM "repository.dtd">

<descriptor-repository version="1.0" isolation-level="read-uncommitted">
<jdbc-connection-descriptor
   jcd-alias="postgreSQL"
   default-connection="true"
   platform="postgreSQL"
   jdbc-level="3.0"
   driver="org.postgresql.Driver"
   protocol="jdbc"
   subprotocol="postgresql"
   dbalias="//93.100.10.99:5432/GSF-DB"
   username="gsf"
   password="gsf"
   eager-release="false"
   batch-mode="false"
   useAutoCommit="0"
   ignoreAutoCommitExceptions="false"
   >

   <connection-pool
       maxActive="5"
       maxIdle="2"
       maxWait="3"
       minEvictableIdleTimeMillis="4"
       numTestsPerEvictionRun="5"
       testOnBorrow="true"
       testOnReturn="true"
       testWhileIdle="true"
       timeBetweenEvictionRunsMillis="6"
       whenExhaustedAction="2"
       validationQuery="SELECT current_date"
       logAbandoned="true"
       removeAbandoned="true"
       removeAbandonedTimeout="8"/>

<sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
<attribute attribute-name="autoNaming" attribute-value="true"/>
</sequence-manager>
</jdbc-connection-descriptor>
</descriptor-repository>


this is the code (is like the example in the documencion)

           MetadataManager mm = MetadataManager.getInstance();

// read connection metadata from repository file
ConnectionRepository cr = mm.readConnectionRepository("...../bases.txt");


           // merge new connection metadata with existing one
           mm.mergeConnectionRepository(cr);


//this section works if the file metadata is in reopsitory_database.xml
impl = OJB.getInstance();
db = impl.newDatabase();
db.open("postgreSQL", Database.OPEN_READ_WRITE);



this is the error message:
org.apache.ojb.broker.PBFactoryException: There was no default-PBKey specified
at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(PersistenceBrokerFactoryBaseImpl.java:157)


at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(PersistenceBrokerFactory.java:65)

   at logica.persistence.Persistence.openManualPersistence


any Ideas

                  Best Regard MM


--------------------------------------------------------------------- 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