Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to database with Oracle

Status
Not open for further replies.

evergreean

Technical User
Feb 15, 2006
68
US
I have always used Access for my database sources for my Cold Fusion pages. Now using Oracle and I connect using sqlplus:
sqlplus jones/mypassword@//abcd123c/xyz

I assume xyz is my database source name that I would connect to?

My question is what or how are you Cold Fusion developers who use Oracle finding your database name or database source name so that you can connect to the Oracle 9i database?

Code:
<cfquery name="cityquery" datasource="xyz">
   Select * from Capital
</cfquery>
 
You have to define your datasource in the CF Admin. And, depending on which version of CF you're using determins how you have to connect. Enterprise edition has Oracle support built in, just select it from the list and away you go, everything else requires you to set up a JDBC manually.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
To elaborate, if you're using CF Standard, you can download the JDBC drivers from Oracle, and create a connection through the CF Admin just like your other datasources. I've done it with several Oracle servers using CF Standard. I used to have several threads here on TT with detailed instructions, but they all seem to have disappeared.


1) Make sure you have the JVM Class Path set up correctly in the "Java and JVM" portion of the CF Admin.

2) In the CF Admin select "Other" as your datasource. For the JDBC URL type the following: jdbc:eek:racle:thin:mad:0.0.0.0:1521:eek:rcl (where 0.0.0.0 is the IP address of your Oracle Server. I think you can put a server's name here as well, but I just used the IP)
For "Driver Class", type: oracle.jdbc.OracleDriver
For "Driver Name", type: oracle
Then add your username and password in the appropriate fields.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Thanks your description helps me understand it alot. Sounds like connection syntax on my web page is the same syntax as JSP.

Is this how the CF page would look with my MX 6.1 version?

Code:
<cfquery name="cityquery" datasource="jdbc:oracle:thin:@0.0.0.0:1521:orcl,jones,mypassword">
   Select * from Capital
</cfquery>
 
Are you using the Enterprise or Standard edition of CF? The connection I was referring to was setting up the Datasource in the CF Administrator. I don't know if it would work directly from a query like that or not. It would be interesting to see.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
We are using MX 6.1 and the Server admins would be setting up my connection. I think we have Standard edition but not sure. I was hoping to find out how I would connect to the Oracle database with my CFQUERY tag.

Please advise if I am in right direction??
 
If the Server Admins set up the connection for you, all you need is the name of the connection to use in your cfquery tag. For example, if they set up a datasource connection to your Oracle server and name it "ORA1" your cfquery would look like:
Code:
<cfquery name="cityquery" datasource="ORA1">
   Select * from Capital
</cfquery>
If they name the connection "bob", then your datasource would = "bob".


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top