title: How to change initial password when programmatically creating a Neo4j DB in Java
body: <p>I need to programmatically create a Neo4j DB and then change the initial password. Creating the DB works, but I don't know how to change the password.</p>
  <pre><code>        String graphDBFilePath = Config.getNeo4jFilesPath_Absolute() + &quot;/&quot; + schemaName;        // This is an absolute path. Do not let Neo4j see it.
          GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( new File(graphDBFilePath) ); // See http://neo4j.com/docs/java-reference/current/javadocs/org/neo4j/graphdb/GraphDatabaseService.html
  
          // This transaction works
          try (Transaction tx = graphDb.beginTx()) {
              Node myNode = graphDb.createNode();
              myNode.setProperty( &quot;name&quot;, &quot;my node&quot;);
              tx.success();
          }
           // This transaction throws an error
           Transaction tx = graphDb.beginTx();
           try {
               graphDb.execute(&quot;CALL dbms.changePassword(\'Spoon_XL\')&quot;);     // &quot;Invalid attempt to change the password&quot; error
               tx.success();
           } catch (Exception ex) {
                  Log.logError(&quot;createNewGraphDB() Change Initial Password: &quot; + ex.getLocalizedMessage());
           } finally {tx.close(); graphDb.shutdown();}
  </code></pre>