Coldfusion apps in the Stax cloud

The datasources that are created for our applications in the Stax cloud will get expired once the application is closed (remember this is a beta!!). We can overcome this problem by executing the code for creating the datasource on Application start every time.

For example we can run the following code snippet on the OnApplicationStart() function for your Coldfusion app.

<cfinvoke
 component="CFIDE.adminapi.administrator"
 method="login"
 returnvariable="credentials">
	<cfinvokeargument name="adminPassword" value="admin" />
</cfinvoke>
<cfinvoke
 component="CFIDE.adminapi.datasource"
 method="setOther">
	<cfinvokeargument name="name" value="YourDsnName" />
	<cfinvokeargument name="url" value="jdbc:stax://YourDsnName" />
	<cfinvokeargument name="class" value="com.staxnet.jdbc.Driver" />
	<cfinvokeargument name="driver" value="Stax JDBC" />
	<cfinvokeargument name="username" value="YourUserName" />
    <cfinvokeargument name="password" value="YourPassword" />
</cfinvoke>

Now regarding deploying a coldfusion application in the Stax cloud there are things that to be noted such as it doesn’t support the CF Ajax libraries. To limit deployment overhead, the Stax application wizard creates applications based on the coldfusion-core template, which doesn’t include the CF AJAX libraries or the CF Admin, so you need to use the Stax SDK to create a CF application with the AJAX features.

You can create a full coldfusion application using the following Stax SDK command:

stax create -t coldfusion mycfapp

🙂

Advertisements

1 Comment (+add yours?)

  1. Steven Erat
    Jun 25, 2009 @ 18:26:42

    I’ve just set up BlogCFC to run on Stax. I learned that if you use the adminapi to login to the administrator, then you cannot use CFLOGIN further down in your code. This is a bug in the adminapi (adminapi uses cflogin under the hood and does not use applicationtoken). This means that if you run the cfinvoke code above in the App.cfm or App.cfc, then you cannot log into blog/admin/.

    For that situation you have to run the cfinvoke code one time (ever) in a seperate location on Stax, then run blogcfc. (Spike at Stax said the datasource creation code only needs to be run one time ever for any Stax application. No need to run it every time in onApplicationStart)

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: