Solved

Cold Fusion - dsn-less connection to SQL server database

Posted on 2004-03-22
7
278 Views
Last Modified: 2013-12-24
is there a way of using a DSN-less connection with Cold Fusion MX to connect to a SQL database (located on a different server to CF)? I have seen the following code around, but it doesn't seem to work for CF MX...just generates an error that CONNECTSTRING is not supported.

<cfset Connection = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=XXX;Password=XX;Initial Catalog=XXX;Data Source=IP ADDRESS;Network Library=DBMSSOCN">
<CFQUERY NAME="Test" DBTYPE="dynamic" CONNECTSTRING="#Connection#">
SELECT * from SomeTable
</CFQUERY>
0
Comment
Question by:garthdonovan
7 Comments
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 64 total points
ID: 10654897
Its not supported anymore in CFMX, I think (not sure) that if you want a DSNless connection you need to use ADO..
0
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 62 total points
ID: 10655586
Use CF Native drivers [CFADMIN] to create DSN - they r much efficient & faster !

as rightly said above - DSNLess connections are not supported ne-more in CFMX !
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 62 total points
ID: 10658789
It is safer anyway not to use a DSNless connection as your example, because if someone gets your page code they get your security information and can hack your server.

That is one of the reasons that they moved away from DSNless connections
0
 
LVL 5

Assisted Solution

by:Seth_Bienek
Seth_Bienek earned 62 total points
ID: 10717927
Just to reiterate what Tacobell777 said, CFMX does not support DSNless connections.

That's the bad news.

The good news is that CFMX does use JDBC for database functionality, which means you can extend java classes directly to do your database stuff.

Dan Plesse has a library of code he developed just for this purpose, that lets you "add, update or delete data from any database from any location", aka, DSNless connections.

I have to stress to you that I have not used any of his code, nor looked at it personally.  But it might work for you, or at least give you some ideas for an approach of your own.

Let us know how it works out!

Take Care,

Seth
0
 
LVL 5

Expert Comment

by:Seth_Bienek
ID: 10717931
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now