Solved

Connecting to SQL WITHOUT DNS

Posted on 2008-10-20
7
283 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
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.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
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 set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

776 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