• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with jakarta commons dbcp

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I use sybase as the database for my db.For establishing connections I use the Jakarta commons Dbcp.The database URL,username and password are stored in the jocl file like this:

<object class="org.apache.commons.dbcp.PoolableConnectionFactory" xmlns="http://apache.org/xml/xmlns/jakarta/commons/jocl">
<!--
The first argument to PoolableConnectionFactory is a ConnectionFactory.
We'll use a DriverManagerConnectionFactory, passing in the appropriate
connect string for the underlying driver.
-->
<object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
<string value="jdbc:sybase:Tds:172.20.65.181:3306/efind_uk01?jconnect_version=6"/>
<string value="enh_find_update"/>
<string value="m0zart"/>
</object>
.....

And I establish connection by:
Connection conn = DriverManager.getConnection("jdbc:apache:commons bcp:/aolintlDevDriver");


Now i want to invoke a perl script from my servlet and pass the values of the databasename,username and password to the perl script.
The problem is how to get the password in the servlet code so that I can pass it to the perl script.
I can get the database name and the user name by geting the DatabaseMetaData object from the connection object.But the password is the one whose value I cannot access.
Please tell me how i can do that?

Thanks in advance,
Sunetra.
 
author & internet detective
Posts: 41861
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sunetra,
You can read in the XML file and use a parser to get the password.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or another suggestion is to define all of these as name/value paramenters in the application's web.xml i.e.

reply
    Bookmark Topic Watch Topic
  • New Topic