Kay lives here

working with the web

ColdFusion_icon

Creating Derby embedded databases in ColdFusion 8

blue

After read­ing about Derby, the open-source data­base engine from Apache included with Cold­Fu­sion 8, I got the idea that the embed­ded ver­sion would be a great tool for dis­trib­ut­ing sam­ple appli­ca­tions, which often use Access data­bases or include a script to cre­ate an SQL Server or MySQL database.

Ben Forta briefly explains the dif­fer­ence between the client-server ver­sion and the embed­ded ver­sion of Derby, and then describes how to cre­ate an embed­ded data­base at the same time as the data­source is cre­ated in the Cold­Fu­sion Admin­is­tra­tor — you just need to add “create=true” to the con­nec­tion string field in the advanced set­tings, to tell the engine to cre­ate the data­base if it doesn’t already exist. Pretty simple:

Creating a Derby embedded datasource in the ColdFusion Administrator

For sam­ple appli­ca­tions, which are typ­i­cally installed on devel­op­ment machines that have access to the Cold­Fu­sion admin­is­tra­tor, it can be done entirely through code using the AdminAPI:

 

 

This is a great addi­tion to Cold­Fu­sion and def­i­nitely some­thing I’m going to be using. The end of reliance on Access, imag­ine that!

2 Comments

  1. Remem­ber that you must prove that you know your CF Admin­is­tra­tor pass­word before <cfinvoke>‘ing the cfide.adminapi components.

    <cfin­voke component=“cfide.adminapi.administrator” method=“login” adminPassword=“mY_sEcReT_aDmIn_PaSsWoRd” >

    <cfin­voke component=“cfide.adminapi.datasource“

  2. does this work on all platforms ?