Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql Server 2005 Connection help 1

Status
Not open for further replies.

azrobert

Programmer
Apr 27, 2002
392
US
This is probably a very bassic question, I have seraced and not found an answer.

I have a sql 2005 database on my hosting server and I am able to connect and query it like this:

<cfstoredproc procedure="TO_GetOrderCounts"datasource="ConTest"username="UserName"password="password">
<cfprocparam type = "Out" CFSQLType = "CF_SQL_INT" variable = "ConfirmedOrders">
<cfprocresult name="result" resultset="1">
</cfstoredproc>

I am sure I am doing this incorrectly passing the username and password with each query or storedproc, does this create a seperate database login for each connection ?

where and how should I define a datasource to use? Would the application.cfm page be the appropriate place to do this as each user logs in ? and what code / connection string should I use ?


Thanks in advance!
Robert
 
I am not actually trying to connect thru coldfusion, I might be asking this in the wrong form.... I am looking for the proper way to handle the connection from my .cfm pages to the sql database on the hosting server. I am using dreamweaver to build the cfm pages, I am not running coldfusion on my development computer, I test all the pages live. I do have a dsn set up on the hosting server which I am able to use to access the database and that all works fine. I guess my question is really" does each query or stored procedure create a new connection to the dataase, or does coldfusion running on the server handle opening and closing the connections?

Robert
 
If your dsn uses connection pooling, ColdFusion will not open and close a connection for each request. It will maintain a pool of open connections. When you execute a query, ColdFusion grabs a connection from the pool. When finished, the connection is returned to the pool for reuse by other requests.



----------------------------------
 
Thanks!

That explains things a lot more, and I feel more at ease now, I'm still really new at CF and love it so far. I come from a VB world and am still thinking that way :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top