2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

05/28/2004: Documentation Error; Sonic XIS XML Database; Setting Address Size and Cache Size should be KB not MB.

Documentation Error; Sonic XIS XML Database; Setting Address Size and Cache

  • public void setAddressSpaceSize(long size) - The documentation says that size is “the size in megabytes”. However, it really needs to be the size in kilobytes.
  • public void setSize(long size) - The documentation says that size is “the size in megabytes”. However, it really needs to be the size in kilobytes.

Most of the time, you won’t be dynamically changing the sizes so it’s probably better to use the com.exln.dxe.defaultcachesize and com.exln.dxe.defaultassize parameters in the xlnserver.properties file. Note that these values should be in bytes!

04/27/2004: Java, JDBC - How to Handle Exceptions and Errors When Closing, or Freeing, Database Resources

When closing database resources it is possible to get multiple exceptions and it is important not to lose any of them.

All of the tutorials that I have read only show the use of printStackTrace() during exception handling. However, that approach is not sophisticated enough for Enterprise applications. I use the following technique: Exceptions (and Errors if applicable) are held in an ArrayList until all resources are closed. Then the list is examined. If exceptions are present, they are processed as needed.

    // This code is part of my DataAccess class. Other code in the class is responsible for
    // opening the database connection and creating a prepared statement - both are
    // static objects.

    public synchronized static void free() {
        // This list holds any exception objects that are caught.
        List caughtExceptions = new ArrayList();

        if (ps != null) {
            try {
                ps.close();
                logger.debug("free; closed prepared statement.");
            } catch (SQLException e) {
                caughtExceptions.add(e);
            }
        }
        if (con != null) {
            try {
                con.close();
	    	logger.debuf("free; closed database connection.");
            } catch (SQLException e) {
                caughtExceptions.add(e);
            }
        }

        if (caughtExceptions.size() > 0) {
            LogConfiguration.message(caughtExceptions, "Problem closing database resources.");
        }
    }

    // Here is the LogConfiguration.message() method which resides in a different class
    // from the above code.

	public static void message(final List exceptions, final String message) {
	    logger.fatal(message);
	    int throwableIndex = 1;
	    int throwableCount = exceptions.size();
	    for (Iterator iter = exceptions.iterator(); iter.hasNext(); ) {
	        Throwable t = (Throwable) iter.next();
		    logger.fatal("Exception [" + throwableIndex + "] of [" + throwableCount + "]", t);
		    throwableIndex++;
	    }
	}