• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

API's for creating data sources

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In our current application we create datasources for Weblogic using installer, which writes entries into config.xml. Now in WebSphere we have a problem in this approach because the passwords are encrypted and stored in server-cfg.xml.Are there any API's exposed by IBM to perform this function in WebSphere.
regards,
Maruti Nori
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you can,
The following code (from coonection_pool.pdf ) for IBM WAS 4.0 does this,
import com.ibm.websphere.advanced.cm.factory.DataSourceFactory;
try {
//Create a properties file for the DataSource
java.util.Properties prop = new java.util.Properties();
prop.put(DataSourceFactory.NAME, "SampleDB");
prop.put(DataSourceFactory.DATASOURCE_CLASS_NAME,
"COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource");
prop.put(DataSourceFactory.DESCRIPTION, "My sample
datasource");
prop.put("databaseName", "sample");
//Obtain a DataSource from the factory
DataSource ds = DataSourceFactory.getDataSource(prop);
//Bind the DataSource into JNDI
DataSourceFactory.bindDataSource(ds);
} catch (ClassNotFoundException cnfe) {
//check the class path for all necessary classes
} catch (CMFactoryException cmfe) {
//Example of exception: incorrect properties
} catch (NamingException ne) {
//Example of exception:
//datasource by this name may already exist
}
Regards
Senthil
 
Did you just should on me? You should read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic