Scripts: ColdFusion :: Database :: Library Article #1

Developer's Section

Create a new ColdFusion Database Connection
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating: 
Average Votes: (1901)
Rate It:   
Favorites:

Learn to connect to the database using Coldfusion.

Here are the steps you need to follow to connect to the database using Coldfusion Mx.

1.connect to your coldfusion administrator

2.look for the data sources menu, then click ODBC. The ODBC Data Sources Available to ColdFusion page will be displayed.

3.enter a new data source name in the Data Source Name text box.

4.Choose one of the ODBC Drivers in the drop down box. E.g. myODBC mySQL Driver, or Oracle80 ODBC Driver.

5.Click the Add button to add the ODBC driver.

6.Now you can configure the settings to connect to your database.

Edit fields such as:
->The Data Source Name
->Database Description
->Database Name you are connecting to
->Server Host Name( name of the server that hosts your database )
->The Server Porttext ( default is 3306 )
->username and password

7.Click add connection

8. you can use it in your .cmf files the following way:

 Code Snippet 1


    <cftransaction action="BEGIN">

    <cfquery name="update" DATASOURCE="My new Connection" 
      DBTYPE="Mysql">
    
    UPDATE STUDENTS SET 
    STATUS='enrolled',
    GRADE='3 GRADE',
    ACTIVE='TRUE'
    WHERE ENROLL = 'TRUE'

    </cfquery>

    <cftransaction action="COMMIT" />

    <cfset confirmationMsg="Table Students has been updated successfully">

    <cfoutput>
    <font color="red">#confirmationMsg#</font>
    </cfoutput

    </cftransaction>


   


See other Scripts in Database

 

Submit Your Scripts:

If you would like to have your ColdFusion scripts published in this section please fill out
the form below:
*Your Name or
Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]
  

 


© 2018 Erobo Software, Inc. All Rights Reserved. | Read Privacy Notice | RSS