Is there any way in open db to get info on all the defined
datasources? This is for an ad hoc query tool, and what I need is the
name, and ideally the db type and version, or lacking that, driver
name.
Current code, somewhat out of context, is this, which works on cf and
railo:
---
<cfset dsService = getCFServiceFactory().getDataSourceService()>
<cfset dsns = dsService.getDatasources()>
<cfset sqlDSNNamesList = ListSort(StructKeyList(dsns), "textnocase")>
<cfloop list="#sqlDSNNamesList#" index="dsn">
<cfset sqlDSNDisplayNamesList = sqlDSNDisplayNamesList & dsn & " (" &
sqlGetDsnDriver(dsns[dsn]) & "),">
</cfloop>
<cffunction name="sqlGetDsnDriver" output="false" returntype="string">
<cfargument name="dsnInfo" type="struct" required="yes">
<cfif server.coldfusion.productName eq "railo">
<cfreturn
ListLast(arguments.dsnInfo.getDataSourceDef().ClassName,
".")>
</cfif>
<cfreturn arguments.dsnInfo.driver><!--- cf --->
</cffunction>
---
Problem number one is that cfdumping dsService, it has no
getDatasources method, only getDatasource (singular), and no obvious
way to enumerate the existing datasources to call it on each one.
Problem number two is that even passing a known name to getDatasource,
I can't figure out how to find out anything very useful about what
kind of db it is. Best effort so far is this:
---
dsService.getDatasource('speicifications').getClass().getName()
---
...but all that gets me is "coldfusion.sql.CFDataSource", nothing
about whether its sql server, oracle, mysql, etc.
Any thoughts? Where in general would I find this kind of info for open
bd?
Thanks much for any ideas,
e
--~--~---------~--~----~------------~-------~--~----~
Open BlueDragon Public Mailing List
http://groups.google.com/group/openbd?hl=en
official site @ http://www.openbluedragon.org/
!! save a network - trim replies before posting !!
-~----------~----~----~----~------~----~------~--~---