Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connecting to SQL WITHOUT DNS

Posted on 2008-10-20
7
Medium Priority
?
289 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
What You Need to Know when Searching for a Webhost Provider
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

916 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