Solved

Connecting to SQL WITHOUT DNS

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delete from table 6 45
Nameserver and MX Record 2 63
Selection from table2 where criteria for table1 10 32
Restrict result set 1 34
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
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…

920 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