> Is there an easy way to get a list of ODBC datasources on the 
> server through ColdFusion?

Yes. You can use CFREGISTRY to read the HKLM\SOFTWARE\ODBC\ODBC.INI key. If
you want native data sources, you can read the appropriate CF registry key.

> Also, given a datasource, is there a way to get a list of
> tables from that datasource?

I don't know if there's a generic ODBC command to get a list of tables (I
seem to remember something about SQLTables, but it's been a while since I've
looked at lower-level ODBC programming), and even if there was, I don't know
how you'd access that at the passthrough SQL level that you use to interact
with ODBC datasources from within CF.

However, most databases have this sort of functionality, and you could
simply look at the registry info for a given datasource to see what database
it uses, then use the database-specific method to get the list of tables.
For example, in SQL Server, you can use the sp_tables stored procedure.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to