View Full Version : Data using ColdFusion
LaszloLover
10-04-2004, 04:44 PM
How do I retrieve data from a database using a ColdFusion script. Are there any code samples/instructions? Thanks in advance for any help.
antun
10-05-2004, 07:27 AM
For the Laszlo part, I'd recommend you take a look at the tutorials (http://www.laszlosystems.com/lps-2.2/docs/guide/tutorials.html), in particular the data tutorial:
http://www.laszlosystems.com/lps-2.2/docs/guide/data-tutorial.html
As for the CF side, you'll need to write your CF scripts to output XML, which should be pretty easy.
-Antun
sromanski
12-27-2004, 08:18 AM
I've been able to pull information from a database and create an XML file which LPS then sends to the flash application. However, when it comes to sending data to the database I get very confused. My knowledge of Java is very limited so the examples don't make much sense to me. I just want to know what the data looks like when it comes from LPS to the application server page. I know CF well enough that I will be able to pull the data out of it...I just don't know what it looks like.
Can anyone send an example of what LPS would send to an applicaiton server when sending data?
Thanks
Simon
antun
12-27-2004, 09:07 AM
Hi Simon
If you're not using SOAP or XML RPC then data going from the Laszlo app to your application server is going to be in the form of HTTP GET or POST parameters, (e.g. getcontacts.jsp?category=2).
Since you won't see the URL change in the browser when your app makes the request, you can use a tool such as Proxomitron that sniffs HTTP headers to check that the right variables are being passed, and indeed that the request is actually being made. (I think there's a Firefox extension that does much the same thing).
-Antun
sromanski
12-27-2004, 12:19 PM
Great thanks,
I got it to work. I'm able to pull URL variables and their associated values. Will LPS also POST data to an application server as FORM variables? It seems that the amount of data you can post via a URL string would be limited.
Simon
ColdCold
12-30-2004, 06:53 AM
just fyi, the last time I looked into the limit for a URL + query-string was back in 1999 or 2000... but I seem to recall that it is browser-dependent and I believe the limit for MSIE at the time was 4kB. This may have changed since then.
chrislyman
12-30-2004, 12:13 PM
To answer your question about POSTing, yup. You can set an attribute of the datasource object so that it POSTs instead of GETs.
Also, in case you want to head down the SOAP path, the datatypes for CF and Laszlo are somewhat incompatible. Simple stuff like strings and arrays work, but complex types don't (at least they don't easily). I have a feeling that there's an answer, but it's proven elusive. Just FYI.
Best,
Chris
pydyp
05-10-2007, 03:56 AM
Some CF code:
<cfquery name="myQuery" datasource="easynet_dev">
SELECT * FROM myTable ...
</cfquery>
<cfloop query="myQuery">
<cfoutput><RECORD></cfoutput>
<cfloop index="i" list="#myQuery.ColumnList#">
<cfoutput><#i#>#XMLFormat(evaluate(i))#</#i#></cfoutput>
</cfloop>
<cfoutput></RECORD></cfoutput>
</cfloop>
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.