Solved

Cold Fusion - dsn-less connection to SQL server database

Posted on 2004-03-22
7
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
What You Need to Know when Searching for a Webhost Provider

732 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