Dynamic Datasources?

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

  1. #1

    Default 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 many
    of these databases will be created dynamically.

    In PHP, I would call the function mysql_select_db() to switch to a different
    database at will, assuming I had already supplied the correct permissions.
    How can this be done in CF MX 6.1?

    g0nzolo Guest

  2. Similar Questions and Discussions

    1. Export Datasources
      I would like to know if you can export the data sources and/or copy the file they are stored in from one coldfusion server to another? If so, what...
    2. 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. ...
    3. 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: ...
    4. Listing Datasources in MX 6.1
      Anyone know what's up with CFMX 7 and doing this same thing? It's clearly been ripped out and re-done with the new funtionality in the api's......
    5. DataSources from Session??
      I have some server controls I've built that store their properties in the ViewState like good little controls :) However, When I set my...
  3. #2

    Default Re: Dynamic Datasources?

    > I cannot utilize the CF Admin as many of these databases will be created dynamically.
    You indeed can [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001734.htm[/url]
    ..



    BKBK Guest

  4. #3

    Default Re: Dynamic Datasources?

    Originally posted by: BKBK
    > I cannot utilize the CF Admin as many of these databases will be created
    dynamically.

    You can in fact
    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001734.htm[/url].



    Wow, thanks. I can't believe I didn't come across this earlier ... I've been
    searching for day. Now another issue ... I can create the datasources, but
    not set the password? It's not even an attribute in the documentation. Anyone
    know how to do this?



    g0nzolo Guest

  5. #4

    Default Re: Dynamic Datasources?

    > I can create the datasources, but not set the password? It's not even an
    > attribute in the documentation.
    I think it's because the password is a property of the database server rather
    than of the Coldfusion server.

    Anyone know how to ... set the password?
    That depends on which database server you use. In
    [url]http://dev.mysql.com/doc/refman/5.0/en/[/url] and put "password" in the search engine.





    BKBK Guest

  6. #5

    Default Re: Dynamic Datasources?

    [url]http://localhost/cfide/adminapi/datasource.cfc[/url] or something similar will
    give you all the methods available.
    HTH,
    Tim
    --
    Tim Carley
    [url]www.recfusion.com[/url]
    [email]info@NOSPAMINGrecfusion.com[/email]
    Mountain Lover Guest

  7. #6

    Default Re: Dynamic Datasources?

    [url]http://localhost/cfide/adminapi/datasource.cfc[/url] or something similar will
    give you all the methods available.
    Some editions of Coldfusion may not come equipped with all the database drivers, though.


    BKBK Guest

  8. #7

    Default Re: Dynamic Datasources?

    Well, its definitly odd. Even listed in this component is the password
    attribute:

    setMSAccess
    public setMSAccess ( required string dsn, required string databasefile, string
    originaldsn="", string driver="MSAccess", string
    class="macromedia.jdbc.MacromediaDriver", string port="19998", string
    username="System", string password="", string epassword="[runtime expression]",
    string description="", string args, string systemDatabaseFile, string
    defaultusername="", numeric maxBufferSize, numeric pageTimeout="600", boolean
    TimeStampAsString="no", numeric timeout, numeric interval, numeric
    login_timeout, numeric buffer, numeric blob_buffer, boolean
    enablemaxconnections, numeric maxconnections, boolean pooling, boolean disable,
    boolean enable_clob, boolean enable_blob, boolean select, boolean create,
    boolean grant, boolean insert, boolean drop, boolean revoke, boolean update,
    boolean alter, boolean storedproc, boolean delete )

    Output: enabled
    Parameters:
    dsn: string, required, dsn - ColdFusion datasource name
    databasefile: string, required, databasefile - database name that
    corresponds to the data source.
    originaldsn: string, optional, originaldsn - original ColdFusion datasource
    name, if you are renaming this dsn.
    driver: string, optional, driver - JDBC driver
    class: string, optional, class - JDBC class file
    port: string, optional, port - port that is used to access the database
    server. (default 19998)
    username: string, optional, username
    password: string, optional, password
    epassword: string, optional, epassword - confirmation password, must be the
    same as password (default is password)
    description: string, optional, description
    args: string, optional, args - connection sting arguments format like this
    (arg1=argvalue;arg2=argvalue)
    systemDatabaseFile: string, optional, systemDatabaseFile - database name
    that corresponds to the data source.
    defaultusername: string, optional, defaultusername
    maxBufferSize: numeric, optional, maxBufferSize
    pageTimeout: numeric, optional, pageTimeout
    TimeStampAsString: boolean, optional, TimeStampAsString
    timeout: numeric, optional, timeout - a time, in minutes, that the server
    allows a data source connection to remain inactive before closing that
    connection.
    interval: numeric, optional, interval - a time, in minutes, that the server
    waits before closing an expired data source connection.
    login_timeout: numeric, optional, login_timeout - Login Timeout (sec)
    buffer: numeric, optional, buffer - Long Text Buffer (chr - default 64000)
    blob_buffer: numeric, optional, blob_buffer - Blob Buffer(bytes)
    enablemaxconnections: boolean, optional, enablemaxconnections - enable
    limit Connections
    maxconnections: numeric, optional, maxconnections - Limit Connections to
    this max amount
    pooling: boolean, optional, pooling - enable server connection pooling for
    your data source.
    disable: boolean, optional, disable - disable connections to data sources.
    enable_clob: boolean, optional, enable_clob - enable long text retrieval.
    enable_blob: boolean, optional, enable_blob - enable binary large object
    retrieval.
    select: boolean, optional, select - allow sql SELECT statements
    create: boolean, optional, create - allow sql CREATE statements
    grant: boolean, optional, grant - allow sql GRANT statements
    insert: boolean, optional, insert - allow sql INSERT statements
    drop: boolean, optional, drop - allow sql DROP statements
    revoke: boolean, optional, revoke - allow sql REVOKE statements
    update: boolean, optional, update - allow sql UPDATE statements
    alter: boolean, optional, alter - allow sql ALTER statements
    storedproc: boolean, optional, storedproc - allow sql stored procedure calls
    delete: boolean, optional, delete - allow sql DELETE statements

    What I get using the password attribute (have tried using epassword as well in
    combination) is a JAVA error

    java.lang.ArrayIndexOutOfBoundsException: 9

    I have updated the macromedia_drivers.jar to Version 3.4 Build 50 ... Any
    other thoughts? :confused;

    g0nzolo Guest

  9. #8

    Default Re: Dynamic Datasources?

    Have you tried this MySQL suggestion I suggested earlier? It works, if you're Root.

    <cfquery datasource="myDSN" name="pw_setter_changer">
    SET PASSWORD = PASSWORD('myNewPW123');
    </cfquery>


    BKBK Guest

  10. #9

    Default Re: Dynamic Datasources?

    java.lang.ArrayIndexOutOfBoundsException: 9
    I would take this as a hint to use all the arguments in the function setMySQL.


    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