Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
External password for database connection
minthril
<p>Hello,<br><br>
I have question about connecting data - like database address, user name and password.<br>
</p>
<p>I made web application for customer but he changes database very often.. It is not good situation for me (to do it and send whole big war file) nor for customer (sending important [may be confidential] data to me).</p>
<p> </p>
<p>Is there any possibility to get this arguments from outer/external place than from rptdesign? If yes could you please attach little/simple example?</p>
<p> </p>
<p>Best regards,</p>
<p>Tomasz</p>
Find more posts tagged with
Comments
pricher
<p>Hi Tomasz,</p>
<p> </p>
<p>Yes, you can externalize database connection properties by reading connection information from a property file.</p>
<p> </p>
<p>In the attached example, the properties file has information about the JDBC URL, the username and the password of a MySQL connection. Of course, you will have to change the values to suit your environment...</p>
<p> </p>
<p>In the report design, the Data Source defines the basic connection information. In other words, even if you externalize the properties, you will need to hard code at least one valid database connection. If you click on Property Bindings in the left hand side of the window, you will get to a screen where you can enter expressions for the different database connection properties. Look at the 3 values for JDBC URL, username and password. In each case, I call the properties file using a simple Java call. You will also need to modify the file location to make it work in your environment.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
micajblock
<p>and the documentation for creating the file is here:</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/be/documentation/ihub3-dev/DAG/index.html#page/DAG/understand-data-sources.03.05.html'>http://developer.actuate.com/be/documentation/ihub3-dev/DAG/index.html#page/DAG/understand-data-sources.03.05.html</a></p>
;
<p> </p>
<p>and deploying here:</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/be/documentation/ihub3-dev/sag/index.html#page/admin/UMC_accounts.08.15.html'>http://developer.actuate.com/be/documentation/ihub3-dev/sag/index.html#page/admin/UMC_accounts.08.15.html</a></p>
;
minthril
<p>Hello,</p>
<p>Thanks for your replies. I have question about external password + .war when I make it from "dynamic web project".</p>
<p> </p>
<p>How can I get this file(password) location to use it for substitution?</p>
<p> </p>
<p>Best regards,</p>
<p>minthril</p>
shiloam
<p>Minthril,</p>
<p> </p>
<p>In the event that you are using the BIRT OS viewer (war you were referring to?) or our Actuate Java Component (AJC) option, the repository base is really the relative base to find acconnprofile files. The repository root is configured in the web.xml of the application, for both OS BIRT viewer and AJC.</p>
<p> </p>
<p>Let me know if this helps clarify the issue somewhat or if I need to provide further information.</p>
<p> </p>
<p>Thank you,</p>
<p> </p>
<p>Steve</p>
minthril
<p>Hello again and sorry for late reply,</p>
<p>I tried to set BIRT_VIEWER_WORKING_FOLDER in web.xml but always I failed. (It is empty now)</p>
<p> </p>
<p>Maybe it is wrong place where I type this location or I type it in wrong way.</p>
<p> </p>
<p>I attach image file with structure of my dynamic web project. Could you please give me some advices what I should change in web.xml to use DB_Info.properties in reports(via Property Binding)?</p>
<p> </p>
<p>Everything in webproject works fine when I try it with Glassfish or Tomcat (via Eclipse) but with hardcoded database connection infos. I would like to give user some flexibility to easily change connection data by little changes in properties file.</p>
<p> </p>
<p>Best regards,</p>
<p>minthril</p>
minthril
<p>Ok I think I made it. Maybe not in fancy way with web.xml but it works. I found something like this <a data-ipb='nomediaparse' href='
http://www.eclipse.org/forums/index.php/mv/msg/277462/780873/#msg_780873'>http://www.eclipse.org/forums/index.php/mv/msg/277462/780873/#msg_780873</a>
; and based on this I changed pricher's code in this way (example with property "JDBCUrl" - "user" and "password" <span><span>analogously</span></span>):</p>
<pre class="_prettyXprint">
props = new Packages.java.util.Properties();
req =reportContext.getHttpServletRequest();
sc = req.getSession().getServletContext();
xyz = sc.getRealPath("/");
input = new Packages.java.io.FileInputStream(xyz + "DB_Info.properties");
props.load(input);
rslt = props.getProperty("JDBCUrl")
rslt;</pre>
<p>When I deploy this to glassfish at my notebook it works.</p>
<p> </p>
<p>Best regards,</p>
<p>minthril</p>