List all available Datasources

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default List all available Datasources

    Hi@all!

    How can I do it, that I get all datasources that are registerd in the
    CF-Server?
    I tried somethin like that but it did'nt work:

    <cfquery datasource="*" name="dbquery">
    show databases;
    </cfquery>

    I hope there is a way because in the CF-Administrator it has ben done in a
    way...
    Can anyone help me please?

    thx

    filesystem Guest

  2. Similar Questions and Discussions

    1. Use CF Datasources outside CF
      I need to create a JSP on the coldfusion server, and access coldfusion datasources in that JSP. Is there anyway to do this in CF6.1 or CF7. ...
    2. Dynamic Datasources?
      I am porting an app from PHP to CF. The app requires the functionality to perform queries on different databases. I cannot utilize the CF Admin as...
    3. How to Provide a list of DataSources and Fields at design time
      I'm developing an WebControl in ASP.NET 2.0. The control inherits from DataBoundControl, so it can be bound to a DataSourceControl by it's...
    4. CFMX Datasources
      To my understanding, previous versions of Coldfusion did not allow you to connect to an Oracle datasource. I was wondering if CFMX Server has this...
    5. accessing two different datasources
      I need to connect to 2 dfferent datasources that are in two different servers. Example: I need to move data from one table on server 1to a table...
  3. #2

    Default Re: List all available Datasources

    >... How can I do it, that I get all datasources that are registerd in the
    CF-Server?

    I shouldn't expect that to be possible, and wouldn't want it either. There
    could be
    security implications. I expect you can only get the list through the
    Coldfusion
    Administrator or through RDS. In any case, it would be technically difficult to
    obtain the database names in an ordinary cfm page by means of cfml code.
    Each datasource may come from a distinct server, may communicate with
    Coldfusion via a distinct port and may or may not require its own set of
    username and password. The cfquery tag, for example, cannot take all that in.



    BKBK Guest

  4. #3

    Default Re: List all available Datasources

    hmm I see, I was a littelbit wrong...

    But can I for example list the Tables of a known DB?
    filesystem Guest

  5. #4

    Default Re: List all available Datasources

    >... hmm I see, I was a littelbit wrong...
    No, you were not. What you ask for is possible, but not in the way you want.
    >... But can I for example list the Tables of a known DB?
    Yes, and you can get the list of datasources, but only through CFAdmin.
    Try this example. You will find the background information in the
    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001734.htm[/url].

    <cfscript>
    adminObj = createObject("component","cfide.adminapi.administr ator");

    createObject("component","cfide.adminapi.administr ator").login("your_CFAdmin_Pas
    sword");
    myObj = createObject("component","cfide.adminapi.datasourc e");
    </cfscript>
    <cfdump var="#myObj.getDatasources()#">

    <!--- NB: The result, myObj.getDatasources(), is a structure --->



    BKBK Guest

  6. #5

    Default Re: List all available Datasources

    Depends on the database you're using. Access holds table names in the
    MSysObjects table. MS SQL uses INFORMATION_SCHEMA views to return DB object
    information. Oracle I'm sure has its own schema query approach.

    philh Guest

  7. #6

    Default Re: List all available Datasources

    >... list of tables IN a known db

    MySQL: Run the query, "SHOW TABLES from datasourceName;"

    MS SQL: Run the in-built stored procedure, sp_tables, for example
    <cfstoredproc procedure="sp_tables" datasource="datasourceName">
    <cfprocresult name="tbls">
    </cfstoredproc>
    <cfdump var="#tbls#">

    BKBK Guest

  8. #7

    Default Re: List all available Datasources

    Will this work for Access db?
    Dinghus Guest

  9. #8

    Default Re: List all available Datasources

    >... Will this work for Access db?
    I can't say. I hardly use Access. A quick look around, and you will find examples involving schema and [url]http://www.irt.org/script/3006.htm[/url].

    BKBK Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139