Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- properties file for JDBC
- javabase.jdbc.url = jdbc:mysql://200.230.71.12:3306/social
- javabase.jdbc.driver = com.mysql.jdbc.Driver
- javabase.jdbc.username = cepein
- javabase.jdbc.password = 1234cinco
- # starting with file:
- shared.loader= /home/shaunkoo/NetBeansProjects/dao.properties
- private static final String PROPERTIES_FILE = "/NetBeansProjects/dao.properties";
- private static final Properties PROPERTIES = new Properties();
- static {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- InputStream propertiesFile = classLoader.getResourceAsStream(PROPERTIES_FILE);
- # starting with file:
- shared.loader= /home/shaunkoo/NetBeansProjects/dao.properties
- shared.loader= /home/shaunkoo/NetBeansProjects
- private static final String PROPERTIES_FILE = "/NetBeansProjects/dao.properties";
- private static final String PROPERTIES_FILE = "dao.properties";
- public static DAOFactory getInstance(String name) throws DAOConfigurationException {
- if (name == null) {
- throw new DAOConfigurationException("Database name is null.");
- }
- DAOProperties properties = new DAOProperties(name);
- String url = properties.getProperty(PROPERTY_URL, true);
- Exception in thread "main" java.lang.ExceptionInInitializerError
- at mydao.DAOFactory.getInstance(DAOFactory.java:82)
- at mydao.DAOTest.main(DAOTest.java:45)
- Caused by: mydao.DAOConfigurationException: Properties file 'dao.properties' is missing in classpath.
- at mydao.DAOProperties.<clinit>(DAOProperties.java:28)
- ... 2 more
- enter code here
Add Comment
Please, Sign In to add comment