Solved

Connecting to SQL WITHOUT DNS

Posted on 2008-10-20
7
278 Views
Last Modified: 2013-12-24
In PHP, ASP, .NET you can connect to a database without the use of DNS entries.  I would like to do the same for a SQL database with ColdFusion.  Does anyone know what the code lines are for something like this.  My goal is to not have to use any DNS entries, so it is completely standalone and can move from server to server without any setup of DNS.
0
Comment
Question by:mopar003
  • 3
  • 2
  • 2
7 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 22762515
0
 
LVL 1

Author Comment

by:mopar003
ID: 22762689
This seems to be the idea of what I am looking for, but usig the examples, I can not get it to work correctly.  Keep coming up with an error

Cannot find CFML template for custom tag query.  
ColdFusion attempted looking in the tree of installed custom tags but did not find a custom tag with this name.  
 
The error occurred in Y:\default\main\ts.internet\checksutterfirst.org\checksutterfirst.org_Live\WORKAREA\checksutterfirst.org\sslforms\designRequest\index.cfm: line 17
 
15 : <cfset dSourceService = factory.dataSourceService />
16 : <cfdump var="#dSourceService.getDrivers()#" />
17 : <cf_query jdbcURL="jdbc:macromedia:sqlserver://XXXXXXX.ORG;databaseName=DesignRequest">
18 : select *
19 : from DesignRequest
20 : </cf_query>

The CFDUMP shows the info, but connecting is still a no go
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 22762702
The upper custom tag sounded good but I did not got it working.
Perhaps this way works for you: http://www.driverweb.com/dsn-less-connection.htm
0
Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

 
LVL 63

Expert Comment

by:Zvonko
ID: 22762717
The query.cfm for that <cf_query> tag is found in the Download zip file.
0
 
LVL 1

Author Comment

by:mopar003
ID: 22762725
That is what I currently use for Access database files, but that doesn't work for SQL Servers.
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 22762822
how about this

<cfscript>
classLoad = createObject(java, java.lang.Class);
classLoad.forName(sun.jdbc.odbc.JdbcOdbcDriver);
dm = createObject(java,java.sql.DriverManager);
conn = dm.getConnection(jdbc:odbc:DRIVER={SQL Server};Database=DBNAME;Server=SERVER NAME OR IP;, LOGIN, PASSWORD);
st = conn.createStatement();
rs = st.ExecuteQuery(SELECT * FROM myTable);
qry = createObject(java, coldfusion.sql.QueryTable).init(rs);
</cfscript>

http://www.fusionteam.co.uk/blog/2008/02/27/coldfusion-dsnless-connection-to-a-database/
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 22762833
check the link as ee seems to have stripped the ""
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

707 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

13 Experts available now in Live!

Get 1:1 Help Now