Guest User

Untitled

a guest
Aug 29th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Cannot save a url as a value in a PropertiesConfiguration object
  2. PropertiesConfiguration pc = new PropertiesConfiguration();
  3. pc.setProperty("url", "jdbc:postgres://localhost:5432/somedb");
  4. pc.setBasePath(".");
  5. pc.setFileName("my.properties");
  6.  
  7. url = jdbc:postgres://localhost:5432/somedb.
  8.  
  9. public class PropertiesTest {
  10. public static void main(String[] args) throws Exception {
  11. Properties props = new Properties();
  12. props.put("url", "jdbc:postgres://localhost:5432/somedb");
  13. OutputStream out = new FileOutputStream("my.properties");
  14. props.store(out, null);
  15. }
  16. }
  17.  
  18. url=jdbc:postgres://localhost:5432/somedb
  19.  
  20. public static void main(String[] args) throws Exception {
  21. File props = new File("my_raw.properties");
  22. BufferedWriter writer = new BufferedWriter(new FileWriter(props));
  23. writer.write("url=jdbc:postgres://localhost:5432/somedb");
  24. writer.close();
  25. }
Add Comment
Please, Sign In to add comment