Search code examples
javadatabasederby

Derby.log output file does not get populated correctly


I'm trying to look at the query plan generated by my database, but derby.log is not getting populated with query info. It contains things like:

  • os.name=Windows 8.1
  • derby.system.home=null
  • derby.database.classpath=''

I'm using the following to attempt to populate it:

CallableStatement queryPlan = conn.prepareCall
    ("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?,?)");
queryPlan.setString(1,"derby.language.logQueryPlan");
queryPlan.setString(2,"true");
queryPlan.execute();
queryPlan.close();

Solution

  • The Derby Reference manual says about derby.language.logQueryPlan:

    This property is static; if you change it while Derby is running, the change does not take effect until you reboot.

    So it is really intended that you set this it the derby.properties or the command line when you start Derby.