Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Can't run queries

    I have a new development machine I have set up that has the same environment as
    my current machine. The database gives an "ok" status in the CF 7 admin and I
    can run queries just fine through the query analyzer. However, CF pages won't
    execute any queries whether they are procedures or standard queries. The error
    message is "Error Executing Database Query"

    The ability to run queries and stored procs is set to yes in the datasource
    settings.

    athanasiusrc Guest

  2. Similar Questions and Discussions

    1. Queries
      hi all, i am using the tutorial: Creating Dynamic Playlist and able to play it correctly, when i open the swf file and i observe that there is 6...
    2. Anyone really good with queries?? :-)
      Given this database structure: GroupNumber GN End Range GroupName CustServInd 7404 Don and Deb Lawyer A 7405 Don and Deb Lawyer ...
    3. Queries of Queries
      Hi, I am trying to combine two queries. The first is a basic query of a table in the database. <CFQUERY NAME="getStores"...
    4. Queries Of Queries Single Quote Problem
      When using queries of queries I'm having the following issue. Select Company_ID From qry_MyQuery Where Company_NM = 'MyString''s' <----...
    5. ASP.net Queries
      Hi Please suggest the solutions for the following questions in asp.net. 1) Is there any Mask edit control in asp.net?. If not possible can...
  3. #2

    Default Re: Can't run queries

    Sounds like a database permissions problem.
    Dan Bracuk Guest

  4. #3

    Default Re: Can't run queries

    Do you log in as SA in QA or as a windows user?

    Anyway, attach the FULL error message here. This includes generated SQL, SQL
    server error code and the snippet of CFM where the error was detected.

    Turn on all error reporting in CF admin.
    Clear the cache files in CF admin.

    If the above info still does not appear, restart the server and try again.


    MikerRoo Guest

  5. #4

    Default Re: Can't run queries

    I us SA for both in development.

    Here is the code. I have tried switching it to cfquery but I get the same
    result

    <cfquery name="Request.getSystemSettings"
    datasource="#request.ds#"
    cachedwithin="#CreateTimeSpan(0,1,0,0)#">
    EXEC pr_getSystemSettings '#cgi.http_host#'
    </cfquery>

    Here is the error:
    Database Exception - in c:\inetpub\aam\fbx_settings.cfm : line 74
    Error Executing Database Query.

    I have rebooted the machine and that didn't fix it. The CFadmin tests the
    datasource as "okay".

    athanasiusrc Guest

  6. #5

    Default Re: Can't run queries

    A proper, full error message looks like the attached. Turn on all debug
    settings
    , restart CF and post the FULL error message here.

    Also in Query Analyzer press Control-O (open new connection).
    When you start QA do you use "Windows authentication" or "SQL Server
    authentication"?




    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Line 1: Incorrect syntax near 'I
    have heard that nothing gives an Author so great Pleasure'.

    The error occurred in C:\data\web\test\ForumProbs\ProperErrorDemo.cfm: line 1

    1 : <CFQUERY name="qFoo" datasource="BTSOperator">
    2 : EXEC [BTS_DB].[dbo].[DELETE_ME] UnexpectedTxt 'I have heard that
    nothing gives an Author so great Pleasure'
    3 : </CFQUERY>

    SQL EXEC [BTS_DB].[dbo].[DELETE_ME] UnexpectedTxt 'I have heard that
    nothing gives an Author so great Pleasure'
    DATASOURCE BTSOperator
    VENDORERRORCODE 170
    SQLSTATE HY000
    Please try the following:Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Line 1: Incorrect syntax near 'I
    have heard that nothing gives an Author so great Pleasure'.

    The error occurred in C:\fakedir\web\test\ForumProbs\ProperErrorDemo.cfm : line
    1

    1 : <CFQUERY name="qFoo" datasource="dsnForumFoo">
    2 : EXEC [BTS_DB].[dbo].[DELETE_ME] UnexpectedTxt 'I have heard that
    nothing gives an Author so great Pleasure'
    3 : </CFQUERY>

    SQL EXEC [BTS_DB].[dbo].[DELETE_ME] UnexpectedTxt 'I have heard that
    nothing gives an Author so great Pleasure'
    DATASOURCE BTSOperator
    VENDORERRORCODE 170
    SQLSTATE HY000
    Please try the following:

    MikerRoo Guest

  7. #6

    Default Re: Can't run queries

    All debug settings are on. I have rebooted. The error I provided is the full
    message I get. When I use query analyzer I use SQL authentication.

    This code works fine on both our production server and another development
    machine.

    Here is the actual sql code:
    CREATE PROCEDURE dbo.pr_getSystemSettings
    @DomainName varchar(100)

    AS
    SELECT
    FaxServer,
    PDFPrinting,
    BarcodePrinting,
    BarcodeText,
    PDFSpooler,
    PDFPath,
    PDFOrderPath,
    ReceiptPath,
    Printing,
    BackgroundColor,
    BorderColor,
    EmailAuth,
    CustomerServiceEmail,
    WebmasterEmail,
    ReturnEmail,
    FaxEmail,
    CCProcessor,
    ProcessorUserName,
    ProcessorPassword,
    ProcessorURL,
    ReceiptMessage,
    DomainName,
    StoreName,
    DifferentShipAddress,
    ShipOutOfCountry,
    CreditAccounts,
    TaxShipping,
    ShippingMethod_Fk,
    WebRoot,
    CFRoot,
    ImgRoot,
    PrintCCReceipt,
    Root,
    ShipApartAmount,
    User_Fk,
    SystemSettings_Pk
    FROM
    SystemSettings
    WHERE
    DomainName = @DomainName

    GO



    athanasiusrc Guest

  8. #7

    Default Re: Can't run queries

    Is it really possible to slam query results directly into the Request
    scope(<cfquery name="Request.getSystemSettings") at query execution time? Even
    if possible, it sounds scary to me.
    Have you tried name="myquery" and later on set Request.xxx to myQuery.xxx?.

    JMGibson3 Guest

  9. #8

    Default Re: Can't run queries

    Request scope is not the problem.

    Ok, you say that:[num]
    [li] All datasources and yourself are logging in as SA.
    [li] NO queries work from coldfusion, using SA, on the bad machine.
    [li] The queries do work from query analyzer, running on the bad
    machine
    and talking to the same database.
    [li] You are not getting the normal full debugging message as I outlined above.
    [/num]

    If all the above is true, then the first thing to check is, are you using ODBC
    drivers with CF. If so, that is the problem, use CF's native JDBC driver when
    you recreate your datasource.

    Either way, Create a new datasource in CF and try it.

    Is there more than one copy of the database? Point a good machine at the bad
    DB and vice versa.

    Does the bad machine have a different locale? Or Asian-language support
    turned on/off different from good machine?

    DB collations or ANSI settings different?




    MikerRoo Guest

  10. #9

    Default Re: Can't run queries

    Great. It works now. Thanks for the help.
    athanasiusrc Guest

  11. #10

    Default Re: Can't run queries

    I also deleted the ODBC dsn from the windows dsn manager and after reinstalling
    it was able to make a connection with the odbc socket through CF. However, the
    queries would cut off all returned variables after the first letter. I have
    never seen that before.

    athanasiusrc Guest

  12. #11

    Default Re: Can't run queries

    Just a thought, have you set up a DSN on your web site hosting account?

    A database connection from your computer is not the same as the database
    connection from your sites connection. You are simply mimicking the DSN
    connection that should already exist on your site's server.

    SSandlin Guest

  13. #12

    Default Re: Can't run queries

    The dsns are set up on the server through the ODBC panel.
    athanasiusrc Guest

  14. #13

    Default Re: Can't run queries

    I have not read the entire thread, so this may not be the question, but
    setting up DNS on the server with the ODBC panel does not make them
    available to ColdFusion, they must also be set up in the ColdFusion
    administrator. By the by many DSN's can be set up in the ColdFusion
    administrator directory without using the ODBC panel.

    athanasiusrc wrote:
    > The dsns are set up on the server through the ODBC panel.
    Ian Skinner Guest

  15. #14

    Default Re: Can't run queries

    I have set up the dsns in CF. If I do it with JDBC I get an error. If I do it with ODBC it only returns the first character of each result.
    athanasiusrc Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139