Advertisement
Guest User

Untitled

a guest
Jul 21st, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. /**
  2. * This class represents a DAO factory for a SQL database. You can use {@link #getInstance(String)}
  3. * to obtain a new instance for the given database name. The specific instance returned depends on
  4. * the properties file configuration. You can obtain DAO's for the DAO factory instance using the
  5. * DAO getters.
  6. * <p>
  7. * This class currently requires a properties file named 'dao.properties' in the classpath with among others
  8. * the following properties:
  9. * <pre>
  10. * name.url *
  11. * name.driver
  12. * name.username
  13. * name.password
  14. * </pre>
  15. * Those marked with * are required, others are optional and can be left away or empty. Only the
  16. * username is required when any password is specified.
  17. * <ul>
  18. * <li>The 'name' must represent the database name in {@link #getInstance(String)}.</li>
  19. * <li>The 'name.url' must represent either the JDBC URL or JNDI name of the database.</li>
  20. * <li>The 'name.driver' must represent the full qualified class name of the JDBC driver.</li>
  21. * <li>The 'name.username' must represent the username of the database login.</li>
  22. * <li>The 'name.password' must represent the password of the database login.</li>
  23. * </ul>
  24. * If you specify the driver property, then the url property will be assumed as JDBC URL. If you
  25. * omit the driver property, then the url property will be assumed as JNDI name. When using JNDI
  26. * with username/password preconfigured, you can omit the username and password properties as well.
  27. * <p>
  28. * Here are basic examples of valid properties for a database with the name 'javabase':
  29. * <pre>
  30. * javabase.jdbc.url = jdbc:mysql://localhost:3306/javabase
  31. * javabase.jdbc.driver = com.mysql.jdbc.Driver
  32. * javabase.jdbc.username = java
  33. * javabase.jdbc.password = d$7hF_r!9Y
  34. * </pre>
  35. * <pre>
  36. * javabase.jndi.url = jdbc/javabase
  37. * </pre>
  38. * Here is a basic use example:
  39. * <pre>
  40. * DAOFactory javabase = DAOFactory.getInstance("javabase.jdbc");
  41. * UserDAO userDAO = javabase.getUserDAO();
  42. * </pre>
  43. *
  44. * @author Leon Merten
  45. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement