This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I'm trying to load driver info, URL info, userID info, and password info for my MySQL database by using a ConnectU.properties file that contains:
I trying to get this info from a java file with that contains the following snippet:
I keep getting the error: Specific Error: Can't find bundle for base name ConectU cal.en_US which is printed from the above catch statement. Can someone please explain how the properties file works and how I can get a program to access this file if I need to write a program for a DB in which the user will not need to know the driver location, URL, login, and password? I hope all of this makes sense as I am green in this area. Thanks in advance, Brian!!!
Brian Snyder
Ranch Hand
Joined: Feb 03, 2001
Posts: 142
posted
0
I actually answered my own question with thanks to long sun. I didn;t realize you had to actually set the properties using a properties file. Thanks!!
Phil Hanna
Ranch Hand
Joined: Apr 05, 2001
Posts: 118
posted
0
I compiled and tested your original code, and it worked fine for me. Are you absolutely sure about the properties file name? It has to be "ConnectU.properties", in the same directory as the .class file (or in the same relative path in a JAR file), otherwise you'll get the error you mention. From the error message, it looks like you tried to load "ConectU.properties", with one "n". Also, if the program is in a package (foo.bar.ConnectU), the getBundle() method must use the full package name prefix ("foo.bar.ConnectU"). So you don't have to explicitly treat the properties file as a java.util.Properties object - it can be a ResourceBundle as well, exactly as you have written it.
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
Brian Snyder
Ranch Hand
Joined: Feb 03, 2001
Posts: 142
posted
0
Thanks Phil. I works for me now as well. It must have been a typo. I was also working on that problem at 4:00 AM. I slept on it and the next day, all was well. Sorry for the confusion!!