I am new to JSPs. I would like to know how can I get the database info (drivername, url, username, password etc.) to load from a config file into the JSP rather than hard coding the values there.
but this is apparently not retrieving any data from the properties file. Can someone tell me where exactly does the .properties file needs to be placed (the directory structure).
Last edited by peter_budo; Sep 25th, 2009 at 4:37 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Re: load database info in a JSP using a config file
Step1: import java.sql.*;[/B]
Step 2: use ResourceBundle sql= ResourceBundle.getBundle("resource.propertiesFileName");
Step 3: use sql.getString("dbUrlStringInPropertiesFile") etc to get values of url, user and pwd.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.