Ask a Question related to Coldfusion Database Access, Design and Development.
-
DesignersRepublics #1
Connecting Coldfusion and Oracle 10g XE (DNS-Less)
Hi all,
I'm new to Oracle 10g XE. I wrote a sample code in coldfusion to connect with
Oracle without using the CFM admin panel (DSN-less). However, I get an error
message :
Exception d'E/S: The Network Adapter could not establish the connection
The error occurred in D:\wwwroot\ColdFusion
www\discovery-4\includes\connection.cfm: line 14
12 : class.forName(driver);
13 : dm = createObject("java","java.sql.DriverManager");
14 : con = dm..getConnection("jdbc:oracle:thin:@//beckers.desrep.com:1521",
"Discovery", "discovery");
15 : st = con.createStatement();
16 : resultSet = st.executeQuery(sql);
When I connect through CFM admin, it's working great. Anyway, I need to
automate DB connections. This means connecting directly to Oracle without using
CFM admin.
My code is :
<CFFUNCTION NAME="connectOracle" DESCRITPION="DSN-less Oracle connection">
<CFARGUMENT NAME="JDBC_URL" REQUIRED="yes" HINT="URL of the Oracle server to
connect to.">
<CFARGUMENT NAME="username" REQUIRED="yes" HINT="Oracle username">
<CFARGUMENT NAME="password" REQUIRED="yes" HINT="Oracle password">
<CFARGUMENT NAME="sql" REQUIRED="yes" HINT="SQL to process">
<CFARGUMENT NAME="oraclePort" DEFAULT="1521" HINT="Port where to connect to
the Oracle server (default: 1521)">
<CFARGUMENT NAME="queryName" DEFAULT="recordset" HINT="Name of the query
results (optional); Defaulted to 'recordset'">
<CFARGUMENT NAME="driver" DEFAULT="oracle.jdbc.OracleDriver" HINT="Driver to
use when connecting to server (optional)">
<CFSCRIPT>
class = createObject("java", "java.lang.Class");
class.forName(driver);
dm = createObject("java","java.sql.DriverManager");
con = dm..getConnection("jdbc:oracle:thin:@//beckers.desrep.com:1521:XE",
"Discovery", "discovery");
st = con.createStatement();
resultSet = st.executeQuery(sql);
"#queryName#" = CreateObject("java",
"coldfusion.sql.QueryTable").init(resultSet);
resultSet.close();
st.close();
con.close();
return "#queryName#";
</CFSCRIPT>
</CFFUNCTION>
Can someone help me?
Thanks,
Fr?d?ric
DesignersRepublics Guest
-
Connecting to Oracle
Can a cold fusion page on an Intranet connect to an Oracle database on another server? -
connecting flex1.5 to Oracle using Coldfusion
I am using Flex1.5 with Coldfusion on JRun4 Server. While publishing data in my flex application, it shows the following error: "You are not... -
Connecting PHP4 to Oracle 9.i
I am trying to get PHP4 to work with Oracle 9.i on Suse Linux I have the DSO version of Apache version 1.3.27 and PHP 4.3.1 Running. I have... -
Error while connecting to Oracle
I have an .asp file where in I make a simple SELECT query to an Oracle table. But I'm getting error as follows. Microsoft OLE DB Provider for... -
HELP: Connecting IIS to an Oracle Database
Did you ever get this resolved? I am having the same problem... Windows 2000 Advanced Server. Oracle client 9.2 "Microsoft OLE DB Provider...



Reply With Quote

