Copy link to clipboard
Copied
Ok, so I have a db connection set up under the ODBC administrator. It is using Oracle 8 or 9 (can't remember) but it is what I use so that I can connect to it through my company's Accounting Software. I want to query it using Dreamweaver and make a CF page of the query.
Here's what I've done:
In CF Admin, I created the datasource, chose ODBC, chose the Server name and username and pw and it connected successfully.
Went into Dreamweaver, added the datasource and Tested Connection--it connected successfully. I can even expand the Tables tree and see the tables.
Now, when I create a query in a new CF document, I get an error when the query runs (like if I'm editing the Record Set and I click Test, it gives me an error).
Here is the error:
MM_ERROR:-1:[Macromedia][SequeLink JDBC Driver][ODBC Socket][Oracle][ODBC][Ora]ORA-00942: table or view does not exist
java.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC Socket][Oracle][ODBC][Ora]ORA-00942: table or view does not exist
at macromedia.sequelink.ssp.Diagnostic.toSQLException(Unknown Source)
at macromedia.sequelink.ssp.Chain.cnvDiagnostics(Unknown Source)
at macromedia.sequelink.ssp.Chain.decodeDiagnostic(Unknown Source)
at macromedia.sequelink.ssp.Chain.decodeBody(Unknown Source)
at macromedia.sequelink.ssp.Chain.decode(Unknown Source)
at macromedia.sequelink.ssp.Chain.send(Unknown Source)
at macromedia.sequelink.ctxt.stmt.StatementContext.execDirect(Unknown Source)
at macromedia.jdbc.sequelink.SequeLinkImplStatement.execute(Unknown Source)
at macromedia.jdbc.slbase.BaseStatement.commonExecute(Unknown Source)
at macromedia.jdbc.slbase.BaseStatement.executeQueryInternal(Unknown Source)
at macromedia.jdbc.slbase.BaseStatement.executeQuery(Unknown Source)
at coldfusion.server.j2ee.sql.JRunStatement.executeQuery(JRunStatement.java:132)
at coldfusion.rds.DbFuncsServlet$DbSqlStatementOperator.processCmd(DbFuncsServlet.java:453)
at coldfusion.rds.DbFuncsServlet.processCmd(DbFuncsServlet.java:77)
at coldfusion.rds.RdsServlet.doPost(RdsServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at coldfusion.rds.RdsFrontEndServlet.doPost(RdsFrontEndServlet.java:104)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Here is the CFM page code:
<cfquery name="qGetTB" datasource="khamp">
SELECT ALL
KHAMELEON.GL_DETAIL.BATCH_NO,
KHAMELEON.GL_DETAIL.ACCOUNT,
KHAMELEON.GL_DETAIL.TRX_DES1,
KHAMELEON.GL_DETAIL.AMOUNT,
KHAMELEON.GL_DETAIL.BK2_AMT,
KHAMELEON.GL_ENTITY_MASTER.ENTITY,
KHAMELEON.GL_DETAIL.SOURCE,
KHAMELEON.GL_DETAIL.FYEAR,
KHAMELEON.GL_DETAIL.PERIOD,
KHAMELEON.GL_DETAIL.TRX_DES2,
KHAMELEON.GL_DETAIL.ACCTG_DATE,
KHAMELEON.GL_ACCOUNT.DES1
FROM KHAMELEON.GL_DETAIL,
KHAMELEON.GL_ACCOUNT,
KHAMELEON.GL_ENTITY_MASTER
WHERE (KHAMELEON.GL_DETAIL.FYEAR='2009' AND KHAMELEON.GL_DETAIL.PERIOD BETWEEN '01' AND '06')
AND KHAMELEON.GL_DETAIL.ACCOUNT='60700'
AND ((KHAMELEON.GL_ACCOUNT.ACCOUNT=KHAMELEON.GL_DETAIL.ACCOUNT)
AND (KHAMELEON.GL_ENTITY_MASTER.ENTITY=KHAMELEON.GL_DETAIL.SUB_ENTITY))
ORDER BY KHAMELEON.GL_DETAIL.ACCOUNT ASC,
KHAMELEON.GL_DETAIL.TRX_DES1 ASC
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ventyx Financial Reports</title>
</head>
<body>
<table border="1">
<tr>
<td>ACCOUNT</td>
<td>DES1</td>
<td>ENTITY</td>
<td>AMOUNT</td>
</tr>
<cfoutput query="qGetTB">
<tr>
<td>#qGetTB.KHAMELEON.GL_DETAIL.BATCH_NO#</td>
<td>#qGetTB.KHAMELEON.GL_DETAIL.ACCOUNT#</td>
<td>#qGetTB.KHAMELEON.GL_DETAIL.TRX_DES1#</td>
<td>#qGetTB.KHAMELEON.GL_DETAIL.AMOUNT#</td>
</tr>
</cfoutput>
</table>
</body>
</html>
Do you know what is going wrong? Also, when I edit the recordset, there is a place for username and pw but if I entere it there, it shows up plaintext in the cfm code which doesn't sound like a good idea. Do I have to enter it there? Even if I do, I still get the error.
Copy link to clipboard
Copied
What about a simplier query?
Can you select a simple record from a single table?
I would confirm that I can get any data from any table or not, then if that works, I can focus on this query.
Your problem may be that your connection is not working OR it may be a syntax error in that large and complex query. Rule out the simple causes first.
Copy link to clipboard
Copied
Should I be using ODBC Socket or Oracle as my driver type in CF Admin?
When I go to the ODBC Administrator in Windows, it shows the System DSN and the driver is Oracle 9.
Copy link to clipboard
Copied
What version of ColdFusion are you using?
Only the Enterprise version has the native Oracle Driver.
The free developer version of ColdFusion is the equivalent to the Enterprise version. And you could use the Oracle Driver to connect directly to the oracle database without the need for any other Oracle Client insalled with the ColdFusion server.
In the Standard version you would have to use a JDBC or ODBC driver. Oracle does provide a JDBC 'Thin Client' driver that is a popular choice.
http://kb2.adobe.com/cps/183/tn_18344.html
Copy link to clipboard
Copied
Yes, I am using the Dev version.
So when you say I can connect directly using the Oracle driver, I still have to set up the data source in CF right? What is the ODBC socket then?
I don't really care how I connect to it honestly, because mainly I don't know the difference. Does it matter if I'm just going to be doing queries through CF?
Copy link to clipboard
Copied
Yes, if you use the Oracle driver, you can create the Oracle dataconnection directly in ColdFusion by providing it the SID, Server, Port, Username and Password for the oracle database to which you are trying to connect.
Using this dirver means you don't need to set up any ODBC or Oracle Listner clients on the maching for ColdFusion. Other software that maybe using those connections is a different matter of course.
ODBC is a ODBC to JDBC bridge that allows ColdFusion to connect to any ODBC connectors you have set up on the Microsoft ODBC pannel.
But you do need a function Data Source configured in the ColdFusion administrator, whether it be an Oracle, ODBC, or "Other" JDBC driver.
Copy link to clipboard
Copied
select 'a' a from dual
is a simple query that you can use to test the connection to any oracle db.