Mauricio Montblanch wrote:
Thanks Again

Another cuestion how do I remove a Database profile from the repositry (so if it incorrect y can add a new one with the same name);


mm.connectionRepository().removeDescriptor(Object validKey)

argument is a PBKey or the JCD instance itself.

Armin



Armin Waibel escribi�:

Mauricio Montblanch wrote:

hi
   adding  mm.setDefaultPBKey(new PBKey("postgreSQL"))  makes it work


ok, in next version of OJB this will be fixed (http://issues.apache.org/jira/browse/OJB-17). Until then you have to use the workaround.


regards,
Armin



Thanks MM

Armin Waibel escribi�:

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]



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