Get ColdFusion DataSource list programmatically
GetDataSourceList.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DataSource List - how to get coldfusion DataSource list programmatically</title>
</head>
<body>
<h2 style="color:Crimson; font-style:italic">DataSource example: how to get DataSource list</h2>
<hr width="500" align="left" color="LightPink" />
<br />
<cfobject
action="create"
type="java"
class="coldfusion.server.ServiceFactory"
name="cfactory"
>
<cfset DSourceStruct=cfactory.getDataSourceService().getDataSources()>
<cfset DSourceList=StructKeyList(DSourceStruct,",")>
<table border="1" cellpadding="2" cellspacing="2" bordercolor="Pink" bgcolor="DeepPink" width="350">
<tr style="color:Snow; font-weight:bold; font-size:large; font-family:'Courier New', Courier, monospace;" height="35">
<td>
ColdFusion DataSource List
</td>
</tr>
<cfoutput>
<cfloop index="i" list="#DSourceList#">
<tr style="font-weight:bold; font-style:normal; color:Snow;">
<td bgcolor="HotPink">
#i#
</td>
</tr>
</cfloop>
</cfoutput>
</table>
</body>
</html>
- cfqueryparam- how to use cfqueryparam in cfquery tag
- How to use cfsqltype in cfqueryparam tag in ColdFusion
- ColdFusion - How to use IS NOT operator in cfif conditional processing
- How to use variable prefixes in ColdFusion
- How to dump and get output server variables in coldfusion
- How to create Microsoft Word document in ColdFusion
- ColdFusion - how to create and dump Application variables
- How to get output in a file or browser using cfdump in coldfusion
- How to create a border type layout in ColdFusion
- How to determine whether a file exists in ColdFusion