Skip to main content

How to connect database in ColdFusion

How to connect database in ColdFusion


Step 1:
Open any broswer and enter the following url

Step 2:
Give your ColdFusion admin login password.

Step 3:

Step 4:

Click Data & Service -> Data Source -> right side show data source screen

Step 5:
Enter your Data Source Name and Driver selection(MySql(4/5), oracle and SQL-server) any one driver seleted and then click add button

Step 6:
Enter Data base name, server, username, password and Description will enter. Here showing details


Step 7:
Click Submit button. Now status is ok so connection is established.

Following query execute in your database(codeigniter)


CREATE TABLE IF NOT EXISTS `employee` (
`id` int(11) NOT NULL,
`name` varchar(30) NOT NULL,
`city` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ;

INSERT INTO `employee` (`id`, `name`, `city`) VALUES
(1, 'sathiyaraj', 'chennai'),
(2, 'KUAMR', 'VELLORE'),
(3, 'raj', 'madrass'),
(4, 'bala', 'madurai'),
(5, 'selvamani', 'vellupuram'),
(6, 'kumar', 'test'),
(7, 'senthil', 'thindukal');

Step 8:
Open Notepad and paste the following code

<cfquery name="EmpList" datasource="mysqlcon" username="root" password="">
select * from employee
</cfquery>

<cfoutput query="EmpList">
#EmpList.id#, #EmpList.name#, #EmpList.city#<br>
</cfoutput>
Save the file in any name and run it.

Step 9:
Output will show like


1, sathiyaraj, chennai
2, KUAMR, VELLORE
3, raj, madrass
4, bala, madurai
5, selvamani, vellupuram
6, kumar, test
7, senthil, thindukal

Comments

Popular posts from this blog

How to use ng-href directive in AngularJS

ng-Href Directive                  ng-Href directive is hyper link markup to a text in angularJs. This hyperlink will change able to implement dynamic url {{hash}} value. Hash value to assign in a controller to happened user click event fire to assign dynamic url. This Value is undefined means it will return to 404 page. ng-Href directive Example  HTML:      <div ng-app="anchor">     <div ng-controller="anchorController">         <a ng-href="http://www.google.com" ng-click="show($event)">Anchor Tag</a>     </div>   </div> Javascript :  var anch = angular.module('anchor', []); anch.controller('anchorController',['$scope', '$window', function($scope, $window){     $scope.show = function(obj) {       $window.open(obj.target.href);     } }]); Result :  Demo

A simple start and stop timer counter in angularjs

     AngularJs using to create a start and stop counting timer functionality application. This application is need the following directive like $interval and $filter , We create default time object is display current timer clock functions.         A timer counter is have three functionality as below that start, stop and reset. A start function is called to start the $ interval directive to active so now counter is begin, This moment you are unable to proceed a reset logic.         Stop function is is call to $ interval belongs one of the method like cancel , This method make corresponding active interval prose is stop it. Reset function is call to reset all scope value is to be zero. HTML: <div ng-app="timerApp">     <div ng-controller="timerController">         Current Time : {{time}} <br/>         <hr/>                <Button ng-click="timer_start()">Start</Button>         <Button ng-click=&

How has lockdown impacted Indian farmers?

How has lockdown impacted Indian farmers?             Generally compare to other sectors it's not major impacted by our Indian farmers but we acceptable minor impacts. Here we separate major two farming cultures one is mono farming culture another one poly farming culture. Mono farming :             The major impacts from our Indian farmer for monoculture. Here I have briefly explained what are the things we had faced our local farmers. Here I explain two different crops type: Daily crops : * We harvest more than 100-kilo grams daily crops like brinjal but we unable to sell those in local markets. * We are unable to reach urban markets. * We don't have enough transport facilities. * We unable buy require fertilizer and other complements * In the early stage we are facing manpower shortage but later it's not an issue. * We unable to do value-added products. * Waste is very high for somedays Sessional Crops: * We major affect transport pr