Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access without ODBC

Status
Not open for further replies.

Krogh

Programmer
Aug 16, 2001
22
CH
I'd like know if there is a way in ColdFusion to use a MS Access database without an ODBC link.

thx for help
 
Hello, Put the following code in your application.cfm file

<!--- enter your dbase name here --->
<cfset REQUEST.dbase = &quot;databasename.mdb&quot;>

<!---gets directory that application.cfm is in --->
<cfset REQUEST.directory = &quot;#getDirectoryFromPath(getCurrentTemplatePath())#&quot;>

<!---sets the connection string --->
<cfset REQUEST.connectstring = &quot;Driver={Microsoft Access Driver (*.mdb)};
Dbq=#REQUEST.dbase#;
DefaultDir=#REQUEST.directory#;
Uid=;
Pwd=;&quot;>


Use this code when you need to access the database:

<cfquery name=&quot;yourqueryname&quot; dbtype=&quot;dynamic&quot; connectstring=&quot;#REQUEST.connectstring#&quot;>
Select fieldname from tablename </cfquery>

This can be slower than an ODBC link but depends on the size of the queried data.
The only dumb questions are the ones that are never asked
 
Just a note, this only works in ColdFusion 5.0; it didn't exist before that version and CFMX doesn't support it.

-Tek
 
Teknology,
You're correct. Sorry I missed adding that note...:> The only dumb questions are the ones that are never asked
 
i saw another way on an older post...
what's about that way ? does it work in MX ?

<cfset dsn = &quot;c:\my_dbase.mdb&quot;>
<cfquery datasource=&quot;#dsn#&quot;
dbtype=&quot;OLEDB&quot;
provider=&quot;Microsoft.Jet.OLEDB.4.0&quot;
providerdsn=&quot;#dsn#&quot;
username=&quot;Admin&quot;
password=&quot;&quot;
name=&quot;qry_get_user_data&quot;>

...

</cfquery>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top