Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help for a newbie : cfquery return the SQL Statement as text

New Here ,
Apr 20, 2011 Apr 20, 2011

Hi All,

After installing Coldfusion ( build in web server) and Oracle database 10g express edition

i am trying to do some basic test on how to query table data using coldfusion datasource name.

I have been successfully able to create a DSN = ORA1 with status OK.

when i tried to print out the data using coldfusion code :

<cfquery datasource="ORA1">
  select * from ROGRAM ;
</cfquery>

when i run the above code i got the follwwing on the browserr:

select * from ROGRAM ;


any help on that will be appreciated.

thanks
TOPICS
Database access
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2011 Apr 20, 2011

Lose the semi-colon. It's not part of the SQL statement, it's a statement separator (and it's client-specific). As CFQUERY is just passing one statement, it's inappropriate.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 20, 2011 Apr 20, 2011

when i run the above code i got the follwwing on the

browserr:

select * from ROGRAM ;

A basic cfquery should not produce any output. It sounds as if your CF code is being rendered as html instead of being executed on the server.

Are you running that code from a .cfm page and are you sure CF is installed correctly?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2011 Apr 20, 2011

hi guys,

thanks fot the quick answers :

1-  i have removed the semi-colon and still the same issue.

2- i am running from a cfm page.

3- how can i know that CF is running coorectly when i was able to add a DSN succesfully ?

ANy other suggestions please ?

thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2011 Apr 20, 2011

Coldfusion is not running when you run your page.  If it was, you would get an error for having a cfquery without a name.

What is the file extension of this page?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2011 Apr 20, 2011

Hi Bracuk,

The name of the page if query1.cfm

And when i preview f12, it dhows the page with the sql statment.

Iam using the following :

running oracle 10g express edition and building my page with macromedia dreamweaver mx 2004

Also runnong coldfusion 9

Thanks.

Sent from my iPhone

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 20, 2011 Apr 20, 2011

If it was, you would get an error for having a cfquery without a

name.

The "name" attribute is not required.

And when i preview f12, it dhows the page with the sql statment.

I do not know how DW works, but you need to run the page in your browser, not just "preview" it. ie View http://localhost:8500/query1.cfm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 20, 2011 Apr 20, 2011

-==cfSearching==- wrote:

And when i preview f12, it dhows the page with the sql statment.

I do not know how DW works, but you need to run the page in your browser, not just "preview" it. ie View http://localhost:8500/query1.cfm

IF Dreamweaver is configured properly, that is what F12 is supposed to do.  Launch the page in a preview browser.  But to do this properly with ColdFusion CFML code:

A) First of all the workstation must have a properly running web server (IIS, Apache, ColdFusion Build-in, etc) properly configured to work with a CFML engine such as Adobe's ColdFusion Application server.

B) The Dreamweaver site must be properly configured with a testing site that will properly put code into a web root in the above configuration and run the code.

I usually don't bother with all of that to get F12 to work properly.  I just end up moving the code to the web root and browsing dirctly to the page in a browser.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 20, 2011 Apr 20, 2011

IF Dreamweaver is configured properly, that is what F12 is

supposed to do. 

Ah, okay. It sounds like it may not be configured properly then.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2011 Apr 21, 2011
3- how can i know that CF is running coorectly when i was able to add a DSN succesfully ?

What URL are you using to access CF Administrator?  And what URL are you using to browse to the URL that runs that query?  it seems odd that your web server is passing the CFAdmin requests to CF, but not other .cfm URLs.

Forget DW, open a browser and browse to the file's URL.  What happens then?


--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 04, 2011 May 04, 2011
LATEST

HI,

I had to uninstall/reinstall  COldfusion and have it working.

thanks everybody

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources