Skip to main content
Inspiring
August 14, 2010
Question

derby embedded question

  • August 14, 2010
  • 9 replies
  • 2837 views

Hello - I am a flash builder developer who has previously worked with mySQL/php, and I am very, very new to cf -- and have a very basic question developing CFB/Flash builder projects using derby embedded as the DB. I just called my webhosting service (a shared resource on crystaltech) and tech support told me I probably could not host a CF project on their server if it was developed using derby embedded, as their IIS-based servers could noptm run apache derby (??) but rather only db's like SQL, mySQL, etc.

Does anyone know if the tech guy (who didn't sound like he was sure) is missing something? I assumed that derby embedded was included in CF9 because it would make integrated development easier, so I was going to use it instead of mySQL, but now I am concerned I will run into problems on my production server.

Any thoughts on this?

Thank you.

Bob

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

Participant
October 21, 2011

When you create the DB from the ColdFusion administrator, CGLOBAL & CDATA can't be created on ColdFusion 8. This is possible on ColdFusion 9.

To to this manually you can use this method.

1) Stop the instance

2) Then connect to the created db with derbyrun :

/opt/jrun4/servers/cfusion15311/cfusion-ear/cfusion-war/WEB-INF/cfusion/db

=> java -jar ../lib/derbyrun.jar ij

ij> connect 'jdbc:derby:cf_variables_storage';

ij> CREATE TABLE CDATA

(

    CFID                                                VARCHAR(64),

    APP                                                 VARCHAR(64),

    DATA                                                LONG VARCHAR

);

0 rows inserted/updated/deleted

ij> CREATE TABLE CGLOBAL

(

    CFID                                                VARCHAR(64),

    DATA                                                LONG VARCHAR,

    LVISIT                                              DATE

);

0 rows inserted/updated/deleted

ij> CREATE INDEX ID2 ON CGLOBAL(CFID);

0 rows inserted/updated/deleted

CREATE INDEX ID3 ON CGLOBAL(LVISIT);

0 rows inserted/updated/deleted

ij> CREATE UNIQUE INDEX ID1 ON CDATA(CFID, APP);

0 rows inserted/updated/deleted

ij> exit ;

/opt/jrun4/servers/cfusion15311/cfusion-ear/cfusion-war/WEB-INF/cfusion/db

3) Then restart the instance...

Regards.

Charlie Arehart
Community Expert
Community Expert
August 14, 2010

Yes, he is mistaken. Derby is in fact embedded in CF 8 and 9 (Standard and Enterprise). There's nothing that he (or you) need to do to "enable it". It's enabled by default. You (and/or he) will find that the CF Admin DSN page offers Derby Embedded as a driver option. Point to it, and either use the checkbox there to say that you're creating a new DB, or place your DB files in the appropriate place in CF (\db\[dbname], by default), if moving them from another server. It's the latter which may trip up a host, if they're not prepared to make it easy/possible for you to put Derby files (the folder in which they are stored) into the appropriate location within CF that they are expected to be found.

Very few people appreciate Derby and its value, especially hosts I suspect. You can point them to the CF docs. This is a documented feature. I also have done presentations on the topic (see http://www.carehart.org/presentations/) and articles (carehart.org/articles/), which could help and also point to still more resources.

Hope that helps.

/charlie

Providing CF troubleshooting services at carehart.org/consulting

charlie@carehart.org

/Charlie (troubleshooter, carehart. org)
bobba1Author
Inspiring
August 14, 2010

Thanks very much for the reply, Charlie. I called my webhost tech support and sent them your posted reply -- this is what they said (below); from their response it appears as if derbyembedded is not an option for me. it is surprising, because crystaltech (my web host) promote themselves as aggressively supporting CF9, so it is a bit odd that they cannot support the derby option. I guess I'll need to use mysql, unless I am (or they are) missing something.

"Hello - I checked with my lead on using the derby databases and he informed me this is not an option on our servers. We do not offer shared Linux hosting, which is where this database works best. I did find a page that would allow the dervy databases to work on a windows environment (IIS), but due to being in a shared environment, we are unable to allow it. You would need to use a MySQL, MS SQL, or access database"

I did forward your post ot this tech, so hopefully he understood that it is an embedded database, but perhaps the issue is placing the file under their CF9 root in a shared environment. Thanks again for your reply, Charlie.

I guess I'll try and get it to work with mySQL

Best,

Bob

Inspiring
August 14, 2010

The files for the Derby database can be placed anywhere on the filesystem, they do not need to be in any shared root.

I do not think there is any technical or security reason why it would not work on a Windows shared server. However, your host may have policy reasons for not allowing it. They may not have trained their support personel, they may not know how to deal with backups, they may not have integrated it with their control panel or whatever. The bottom line is that I doubt you are going to win this one with your current host.