Hi i created a property file named DatabaseConnection_en_US.properties in my application the property file is accessed in a .java class to get connected with the database
DatabaseConnection_en_US.properties
[code]
Driver=net.sourceforge.jtds.jdbc.Driver
URL=jdbc:jtds:sqlserver://DCSRV02:1433/REGISTRATION_TEMP_LTR_PRINT
My DBConnection.java file
[code]
import java.sql.*;
import java.util.*;
public class DBConnection {
public Connection connection =null;
public void connect()
{
ResourceBundle bundle = ResourceBundle.getBundle("PlotManagement.DatabaseConnection");
try {
Class.forName(bundle.getString("Driver"));
String connectionUrl = bundle.getString("URL");
connection = DriverManager.getConnection(connectionUrl,"sa","water");
System.out.println("Connected");
}
catch (Exception e)
{
System.out.println( "<h1>exception: "+e+e.getMessage()+"</h1>" );
e.printStackTrace();
}
}
}
when i execute the .java file by adding main method the file shows its connected with database but when i inialise the file in some
servlet and try to get connected with database it gives me exception:-
java.util.MissingResourceException: Can't find bundle for base name PlotManagement.DatabaseConnection, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at PlotManagement.DBConnection.connect(DBConnection.java:10)
at PlotManagement.GetPropertyDetails.doGet(GetPropertyDetails.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Please suggest me to solve this issue..