db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanket Sharma" <sanketsha...@gmail.com>
Subject Modifying database properties from Code
Date Thu, 17 Aug 2006 18:21:56 GMT
Hi


Can any one please help me out with a little issue?

What is the precise way of accessing a database's properties through
the code given a reference to a BasicDatabase Object?

I thought the following will do :

AccessFactory af = (AccessFactory)Monitor.findServiceModule(basicdb,
AccessFactory.MODULE);

if( af!=null) {
       ContextService cs = ContextService.getFactory();
}
if(cs!=null){
              ContextManager cm = cs.getCurrentContextManager();
}
if(cm!=null){
       TransactionController tc = af.getTransaction(cm);
}
if(tc!=null){
       Properties dbProperties = tc.getProperties();
       tc.commit();
       tc.destroy();
       return (dbProperties.getProperty(attributeName));
}

However, the call to getCurrentContextManager returns a null value.

I've written this code inside my MBean Class. My guess is that this
code needs to be in the same "context" as the Database object. How do
I ensure that? Am I missing something?

Again, while updating the values using TransactionController's
methods, I face the same problem.

Can anyone please guide?

Best Regards,
Sanket

Mime
View raw message