programmatically creating a cf5 dsn

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

  1. #1

    Default programmatically creating a cf5 dsn

    Hello,

    I was curious if there was a way to programmatically create a coldfusion dsn
    for a ms sql 2000 database using coldfusion 5.0 code? i have been searching
    the forum for a past posting on this subject and haven't found one but i do
    appologize if i missed it. I would think i could using cfobject but i would be
    very grateful for an example if possible.

    thanks a lot,

    Jeramie

    jeramie72 Guest

  2. Similar Questions and Discussions

    1. Creating connection keys programmatically
      Hi, Is there anyway I can create the connection keys programmatically, using an API or something ? Thanks in advance
    2. Creating and printing PDF files programmatically
      Here are the requirements for my multi platform C++ app (windows, hp-ux and linux) wrt reporting: 1) produce PDF reports 2) store PDF reports in...
    3. programmatically add DSN
      How can I access a db without first registering in CF Administrator datasources? Can I programmatically (like asp) create a datasource in the .cfm...
    4. Saving A PDF as a PNG Programmatically
      I need to save PDFs as BMP files, scaled down in size. The closest thing I found was PDFtoIMG, but it crops the right edge and the bottom edge. I...
    5. Programmatically creating a datagrid control - Events NOT Firing!!!! Please Help
      My Events are not firing. Viewstate is Enabled. My Datagrid's datasource is being set after the Page Load. Is that a problem? How can I make it...
  3. #2

    Default Re: programmatically creating a cf5 dsn

    it's been a while since I tinkered with this code...and I'll dig a
    little deeper if I get time. I think I have some code using cfhttp and
    the cf admin. This might get you started...it uses cfregistry:

    !--- add the datasource --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ ODBC Data Sources"
    ENTRY="#data_source_name#" TYPE="String" VALUE="SQL Server">
    <!--- add datasource key --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini"
    ENTRY="#data_source_name#" TYPE="Key">
    <!--- set the file name --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="Database" VALUE="#FORM.createDB#" TYPE="String">
    <!--- set the description --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="Description" VALUE="" TYPE="String">
    <!--- get the SQL Server Driver --->
    <CFREGISTRY ACTION="GET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST. INI\SQL Server"
    ENTRY="Driver" VARIABLE="gotDriver" TYPE="String">
    <!--- set the driver --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="Driver" VALUE="#gotDriver#" TYPE="String">
    <!--- set the server --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="Server" VALUE="(local)" TYPE="String">
    <!--- set the trusted connection --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="Trusted_Connection" VALUE="Yes" TYPE="String">
    <!--- set the last user --->
    <CFREGISTRY ACTION="SET"
    BRANCH="HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\odbc.ini\ #data_source_name#"
    ENTRY="LastUser" VALUE="" TYPE="String">

    HTH,
    Tim
    --
    Tim Carley
    [url]www.recfusion.com[/url]
    [email]info@NOSPAMINGrecfusion.com[/email]
    Mountain Lover 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