|
JDBCQuery
This Coldfusion Custom Tag uses JDBC to connect to a SQL server, to an Access file, to a Text file or to an Excel file without a DSN (dsnless) in the Coldfusion Administrator. If connecting to an Access database we need:
<cf_JDBCQuery Name="theQueryMDB" DBFile="#expandPath('./')#/AccessDB.mdb">
select top 5 * from Photos
</cf_JDBCQuery>
Text Example:
<cf_JDBCQuery Name="theQueryTxt" DBDir="#expandPath('./')#/">
select top 5 * from theDB.txt
</cf_JDBCQuery>
Excel Example:
<cf_JDBCQuery Name="theQueryXLS" DBFile="#expandPath('./')#/ExcelDB.xls">
select top 5 * from [Sheet1$]
</cf_JDBCQuery>
SQL Example: -- Define here the nedded parameters.
<cf_JDBCQuery Name="theSQLQuery" SQLServer="127.0.0.1" Database="YourDatabase"
user="USER" password="PASSWORD">
select top 5 * from theTable
</cf_JDBCQuery>
|
|