Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting properties file using java
    primarykey
    data
    text
    <p>I have a Swing Frame with some text-fields which displays the current values in the Properties file. Once I modify these properties in the text-field it should be saved back to the properties file. The properties which I have are database connection parameters. My connection parameters are as follows</p> <pre><code>driver--org.postgresql.Driver url--jdbc:postgresql://localhost/bank user--postgres password--aaa </code></pre> <p>But when it updates, in the url field, where ever there is a ':', it adds a '\' like <code>URL2=jdbc\:postgresql\://localhost/bank</code>. How can I avoid this? I tried printing the contents before setting the Properties file and then it is ok. I printed the String before setting the properties, there it is coming right;</p> <pre><code>org.postgresql.Driver **jdbc:postgresql://localhost/bank**postgres**aaa </code></pre> <p>Can someone please help me. Thanks in Advance</p> <pre><code> public static void update(String driver,String url, String user,String password) throws SecurityException, IOException{ System.out.println(driver+" **"+url+"**"+user+"**"+password); FileInputStream in = new FileInputStream("evaluator.properties"); Properties props = new Properties(); props.load(in); in.close(); FileOutputStream out = new FileOutputStream("evaluator.properties"); props.setProperty("Driver2", driver); props.setProperty("URL2", url); props.setProperty("Login2", user); props.setProperty("Password2", password); props.store(out, null); out.close(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload