Kay lives here

working with the web

Creating Derby embedded databases in ColdFusion 8

After reading about Derby, the open-source database engine from Apache included with ColdFusion 8, I got the idea that the embedded version would be a great tool for distributing sample applications, which often use Access databases or include a script to create an SQL Server or MySQL database.

Ben Forta briefly explains the difference between the client-server version and the embedded version of Derby, and then describes how to create an embedded database at the same time as the datasource is created in the ColdFusion Administrator – you just need to add “create=true” to the connection string field in the advanced settings, to tell the engine to create the database if it doesn’t already exist. Pretty simple:

Creating a Derby embedded datasource in the ColdFusion Administrator

For sample applications, which are typically installed on development machines that have access to the ColdFusion administrator, it can be done entirely through code using the AdminAPI:

 

 

This is a great addition to ColdFusion and definitely something I’m going to be using. The end of reliance on Access, imagine that!

2 Comments

  1. Remember that you must prove that you know your CF Administrator password before <cfinvoke>’ing the cfide.adminapi components.

    <cfinvoke component=”cfide.adminapi.administrator” method=”login” adminPassword=”mY_sEcReT_aDmIn_PaSsWoRd” >

    <cfinvoke component=”cfide.adminapi.datasource”

  2. does this work on all platforms ?