Sven --

The call to connectionRepository().getAllDescriptor() returns a deep copy of all of 
the connection descriptors, so any changes you make to those descriptors will not be 
reflected in the global repository.  To do that, you'll have to remove the descriptor 
from the global repository and re-add it.  Something like after you call 
changeDescriptor method should work:

ConnectionRepository connRepo =
    MetadataManager.getInstance().connectionRepository();
connRepo.removeDescriptor(desc);
connRepo.addDescriptor(desc);

HTH

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

> 
> From: [EMAIL PROTECTED]
> Date: 2003/11/07 Fri AM 06:33:01 EST
> To: [EMAIL PROTECTED]
> Subject: modifing JdbConnectionDescriptor at runtime
> 
> Hi,
> I'm trying to modify the default jdbcconnectiondescriptor at runtime.
> I do this by change the PersistenceBrokerFactory implementation to my custom
> class, which extends PersistenceBrokerFactoryDefaultImpl and adds a static
> part like this:
> 
>       static {
>               List descriptors =
> MetadataManager.getInstance().connectionRepository().getAllDescriptor();
>               for (Iterator iter = descriptors.iterator();
> iter.hasNext();) {
>                       JdbcConnectionDescriptor desc =
> (JdbcConnectionDescriptor) iter.next();
>                       if (desc.isDefaultConnection()) {
>                               changeDescriptor(desc);
>                       }
>               }
>       }
> 
>       private static void changeDescriptor(JdbcConnectionDescriptor desc)
> {
>               // modifies the descriptor
>               String dbname = Props.getString("dbname");
>               String dbhost = Props.getString("dbhost");
>               String dbalias = "//" + dbhost + "/" + dbname;
>               log.debug("changeDescriptor - setting dbAlias : " +
> dbalias);
>               connectionDescriptor.setDbAlias(dbalias);
> 
>               // do this for username, password etc. 
>       }
> 
> there is no problem with this all the properties are set. But it seems that
> another operation resets the dbalias, because I get the following error:
>       
>       Error getting Connection from DriverManager with url
> (jdbc:postgresql:) and driver (org.postgresql.Driver)
> 
> I'm using 1.0 rc4.
> 
> Any ideas?
> Sven
> 
> ---------------------------------------------------------------------
> 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