Sagewire Logo

cfml database access RSS Feed

Recent Posts View Recent Posts | View Archived Posts

Message from CNaser
Most recent post: 10/28/2007
2 authors and 2 replies.

I have a longtext field in a MySQL MyISAM table. There are about 100 pages of
text loaded into the field. I can see with a direct MySQL query that the full
text is in the database. However, when I query the table and bring that field
out in CF8, it truncates about halfway through. Since I can pull the complete
contents of the field out with a simple MySQL query outside of CF8, my
assumption is that CF8 is truncating the result. Any ideas why? read more about MySQL Longtext truncated by CF8


Message from swing
Most recent post: 10/26/2007
2 authors and 3 replies.

Hi have this code

<CFPARAM name="URL.typeid" default="1">
<CFQUERY name="rsMake" datasource="cfocean01">
SELECT Make, SUM(qty) AS totalunit
FROM ModTrailerIDStd
WHERE Type = '#URL.typeid#'
AND PostonWeb = "1"
GROUP BY Make
</CFQUERY>
<CFQUERY name="rsType" datasource="cfocean01">
SELECT Type, SUM(qty) AS totalunit
FROM ModTrailerIDStd
WHERE Type <> '#URL.typeid#'
AND PostonWeb = "1"
GROUP BY Type
</CFQUERY>

it is displaying fine in my old ColdFusion server 7 (no update). Once I move the page
to the new ColdFusion server 7 (7.0.2) update, it cannot display it. I removed section
by section to see which area of codes has problem. It ends up with this
queries.

Do I need to just forget about the update 7.02? I just do not move my files to
a new server.
Please help.
Thanks read more about update 7.0.2 query executoin error


Message from Lynda
Most recent post: 10/26/2007
4 authors and 22 replies.

I recently reinstalled SQL Server and now I am unable to create the DSN through ColdFusion Admin. The name of the SQL instance was changed during the reinstall. I
have attempted to use the new name in CFADMIN but get the following error:

"JAVA.sql.SQLException: [Macromedia][SQLServer JDBC
Driver][Macromedia][SQLServer JDBC Driver]The requested instance is either
invalid or not running.
The root cause was that: JAVA.sql.SQLException: [Macromedia][SQLServer JDBC
Driver][Macromedia][SQLServer JDBC Driver]The requested instance is either
invalid or not running."

The instance is running and I can create a connection through the Data Source
(ODBC) tool in Admin Tools but I can set it up in CFAdmin.

Thanks in advance for your advise! read more about Cannot Connect to SQL 2000


Message from pajonas
Most recent post: 10/26/2007
2 authors and 2 replies.

Hello,

My current Cold Fusion website has a left hand navigation bar that I'd like
to have sub categories flyout with JAVAscript that I'll use. I am having
trouble querying the database to have the subcategories line up under their
parents.

My first query is below, this grabs the parent or first level of the left hand
side bar:

<CFQUERY name="CATEGORY_LIST" datasource="#datasource#">
SELECT cID,CategoryName
FROM CATEGORY
WHERE Visible = 1
AND ParentCategory = 1
ORDER BY CategoryName ASC
</CFQUERY>
I have a second query to grab the children or second level:

<CFQUERY name="CATEGORY_LIST2" datasource="#datasource#">
SELECT cID,CategoryName,ParentCategory
FROM CATEGORY
WHERE ParentCategory > 1
AND Visible = 1
ORDER BY CategoryName ASC
</CFQUERY> The first level of menu items have a ParentCategory that equals 1
The second level of menu items have a ParentCategory that equals whatever the
Category Id of the first level is. Soo for example electronics has a
ParentCategory of 1 and a cID of 22. Both iPods and TVs have ParentCategorys of
22.

Electronics
iPods
TVs

I loop through the first query and output and then I have another loop inside
the main loop that outputs the children. I think I just need to somehow say
that the second loop runs only when the Category ID (cID) equal the
ParentCategory.
I have a loop as you'll see in my below code that has a condi read more about Outputting sub categories under parent from database


Message from sengung1234
Most recent post: 10/26/2007
3 authors and 3 replies.

<CFQUERY name="getData" datasource="#THIS.dsn#">
SELECT FirstName,LastName,Emp_ID, Email FROM employees
</CFQUERY>

Any code examples of converting above query to the below JAVAscript Array?
could you share! Thanks!

var myData = [
['Carolynn','Peterson',1,'CPETERSON'],
['Dave','Heartsdale',2,'FHEARTSDALE'],
['Linda','Stewart',3,'LSTEWART']
]; read more about Array of Array JAVAscript


Message from atommy06
Most recent post: 10/26/2007
2 authors and 4 replies.

Hello everyone, I have a problem when trying to return a REF CURSOR from an
Oracle 9i database. The version of my Cold Fusion is the number 6. The error
message is ".... sqlType = 2006 ....". I leave my code here. Please someone
help me. Thank you. Tommy.

Cold Fusion code:

<CFSTOREDPROC procedure="OracleTest.sel_user" datasource="test_ora_dsn">
<CFPROCPARAM type="Out" cfsqltype="CF_SQL_REFCURSOR" variable="param1">
<CFPROCRESULT name="qry_sel_user">
</CFSTOREDPROC> PL/SQL code:

CREATE OR REPLACE PACKAGE OracleTest
AS
TYPE user_cursor IS REF CURSOR
RETURN Users%ROWTYPE;
PROCEDURE sel_user (
results OUT user_cursor;

END OracleTest;

CREATE OR REPLACE PACKAGE BODY OracleTest
AS
PROCEDURE sel_user (
results OUT user_cursor
)
AS
BEGIN
OPEN results FOR
SELECT *
FROM Users;
END sel_user;
END OracleTest; read more about Problem returning REF CURSOR from Oracle


Message from Lynda
Most recent post: 10/26/2007
2 authors and 9 replies.

Can anyone tell me why I'd run into the following error when using an ODBC
Socket Connection vs the Microsoft SQL Server driver?

"ByteArray objects cannot be converted to strings."

I am using a SQL uniqueidentifier as a folder name I want to direct users to.
On my remote sql server I use the sql driver. On my local sql server I use the
socket connection (I cannot get the sql driver to work). All works as expected
if I use my remote connection. The local gives the error above. read more about ODBC Socket Connection


Message from swing
Most recent post: 10/25/2007
2 authors and 7 replies.

My access.mdb is in server1's public share folder (everyone has right to change
or delete) and I am trying to connect my access.mdb from my ColdFusion server
(windows 2003 r2 std). It works if I put the mdb to local but not network.

I got this error

Connection verification failed for data source: CFMYDATA
com.inzoom.adojni.ComException: Not a valid file name.
The root cause was that: com.inzoom.adojni.ComException: Not a valid file
name. in Microsoft JET Database Engine code=0 Type=1

The Cold Fusion service is running under the adminstrator user and password. I
used the UNC path but still no luck.

Anyone has any idea to me. read more about Connection Failed for the network data souce


Message from murrayt5
Most recent post: 10/25/2007
4 authors and 6 replies.

First, let me state that I'm new to Oracle and using it with Cold Fusion, but
I have used ColdFusion on and off for the past 6 years. So this might be a simple
"newbie" problem with Oracle and ColdFusion

wrote in message the following simple Oracle procedure to concatenate three
variables together (I know I could do this in ColdFusion directly, but I need to be
able to use his existing procedures in Oracle)

SPEC:
function ShowCaption(inprecaption in long,
incaption in long,
inpostcaption in long,
method in varchar2,
xcoord in number,
ycoord in number)
return long;

BODY:
function ShowCaption(
inprecaption in long,
incaption in long,
inpostcaption in long,
method in varchar2,
xcoord in number,
ycoord in number)
return long
is
begin
return inprecaption || incaption || inpostcaption;

end ShowCaption;

So I have the following in my CFML page to use that procedure:
<CFSTOREDPROC procedure="RIX.EDC.ShowCaption" dataSource="#request.dsn#"
result="boo">

<CFPROCPARAM
CFSQLType="CF_SQL_LONGVARCHAR"
type="in"
variable read more about Help with calling Oracle Procedure


Message from swap_18
Most recent post: 10/24/2007
4 authors and 9 replies.

Hi
I am using Microsoft Access to create my database and I want Cold Fusion to be able to
access this. I have the following question: What is the system database file? (
iam using windows xp pro)
Is it "windows\system32\system.mdw "?

I am having an error when I hit submit:

Connection verification failed for data source: contact
JAVA.sql.SQLException: [Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Not a valid account name or
password.
The root cause was that: JAVA.sql.SQLException: [Macromedia][SequeLink JDBC
Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Not a valid
account name or password.
Please tell me how to resolve this issue. read more about Problem accessing MS Access database


Message from dongzky
Most recent post: 10/24/2007
2 authors and 3 replies.

Hello, please help me. I am quite new to oracle stored procedures. I have a
proc that returns data to CFM but it keeps giving zero results. But if i do not
use stored proc, the same query gives me something. please help. my stored proc
and CFM goes something like below:

************************************ stored procedures
**************************************
CREATE OR REPLACE PACKAGE PACK_REFCURSOR_NHM_TRANSACTION AS
TYPE TRANS_TableRows IS REF CURSOR;
PROCEDURE REFCUR_NHM_TRANSACTION (
IN_sTMPACC IN varchar2,
IN_sITEM_TYPES IN varchar2,
OUT_TRANS OUT TRANS_TableRows);
END PACK_REFCURSOR_NHM_TRANSACTION ;
/

CREATE OR REPLACE PACKAGE BODY PACK_REFCURSOR_NHM_TRANSACTION AS
PROCEDURE REFCUR_NHM_TRANSACTION (
IN_sTMPACC IN varchar2,
IN_sITEM_TYPES varchar2,
OUT_TRANS OUT TRANS_TableRows)
IS


BEGIN

OPEN OUT_TRANS FOR
SELECT T.TRANSACTION_ID, T.TRANSACTION_TYPE, T.TRANSACTION_DATE,
T.TRANSACTION_TIME,
T.ITEM_CODE, 0 OE_DETAIL_ID,
T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE, T.GST_AMOUNT, 'I'
INSURER_TYPE
FROM NHM_TRANSACTION T
WHERE DISPENSED_FLG = 'Y'
AND T.ACCOUNT_ID = IN_sTMPACC
AND T.TRANSACTION_TYPE IN ('01','02', '09')
AND NVL(T.STATUS,'F') != 'C'
AND T.BILLED_FLG = 'N'
AND T.ITEM_TYPE IN (IN_sITEM_TYPES)
AND T.BILL_ITEM_FLG = 'Y'
UNION ALL
SELECT T.OE_TRANSACTION_ID TRANSACTION_ID, TRANSACTION_TYPE,
T.TRANSACTION_DATE,
T.TRANSACTION_TIME, NVL( read more about stored proc returns zero result


Message from MK_Ultra
Most recent post: 10/24/2007
3 authors and 5 replies.

We are changing the database our website uses from MS-SQL to MySQL and in the
course of testing it I have found that the following piece of code will give an
error "Incorrect integer value: for column GraftYear" if the user doesn't type
anything for the graft year value, which is optional.

<CFQUERY name="insertblocks" >
INSERT T_Block (Season,KPIN,BlockName,GraftYear,CreateDtTm)
VALUES (
<CFQUERYPARAM value= "#request.season#" cfsqltype="cf_sql_varchar" maxLength
= "4">
,
<CFQUERYPARAM value= "#attributes.kpin#" cfsqltype="cf_sql_integer">,
<CFQUERYPARAM value="#UCase(Trim(blockdetails[i][1]))#"
cfsqltype="cf_sql_varchar" maxLength = "30">
,
<CFQUERYPARAM value="#blockdetails[i][5]#" cfsqltype="cf_sql_varchar"
maxLength = "4">
,
#CreateODBCDateTime(Now())#)
</CFQUERY>

It works fine with MS-SQL, which inserts the value 0 when passed an empty
string, which is what I think is happening here in this case. When I do a
manual insertion on the table with an empty string then MySQL stores a zero the
same as MS. I know that I'll have similar problems with other parts of the
site so I am wondering if there is a reason why this is happening. The table is
set to allow null values in this field, and the default value is NULL. Should I
set the default value to zero maybe?

Any help much appreciated... read more about MySQL Null Field


Message from Henweigh99
Most recent post: 10/23/2007
4 authors and 17 replies.

Hello All,

I have an unusual situation where I am trying to query the database (MSSQL)
using an IN statement and the PK list has approximately 10,000 records in it.
SQL throws an error "The query processor ran out of stack space during query
optimization" which relates to a limitation in MSSQL Server:
(http://support.microsoft.com/kb/288095)

Microsoft's suggestion is to create a temporary table and then JOIN the two
tables to get the results you are looking for. However, in my particular
situation, I do not know how to create a temporary table from just list data.

Here is an example of the Cold Fusion template:

Step 1: Get a list of IDs that this user is allowed to see
Query a bunch of records and sub records and generate a list variable
(#RecordsToGet#)
Note, this query loops several times because of parent/child relationships in
the table. After each loop, the list is appended to.

Example:
<CFSET currentparent = 0>

<CFLOOP condition="ContinueLoop IS 'yes'">

<CFSET LoopCount = LoopCount + 1>

<CFQUERY datasource="#datasource#" name="getMyStuff">
Select ID, Parent
FROM myTable
WHERE Parent = #currentparent#
AND Criteria = '#bla#'
</CFQUERY>

<!-- assign the new parent to a value list and append the master list -->
<CFSET CurrentParent = ValueList(getMyS read more about Trouble with MSSQL query


Message from dwmart
Most recent post: 10/23/2007
3 authors and 4 replies.

Hi I am creating a blog for the first time and have hit a snag. I have
everything working the way I want except that the text is like a run on
paragraph. Unless I use html code inside the text field then it obviously
does not display the paragraphs separately. Using html isnt a problem for me but
I am trying to learn to make things for people who do not know html. So the
question is....what does it take to get the page to at least display the line
breaks between paragraphs when the user simply hits enter when entering the
blog text.

Thanks! read more about creating a blog


Message from dongzky
Most recent post: 10/23/2007
2 authors and 3 replies.

HI, I have created a stored proc in oracle similar below: CREATE OR REPLACE PACKAGE PACK_REFCURSOR_NHM_TRANSACTION AS
TYPE TRANS_TableRows IS REF CURSOR
RETURN NHM_TRANSACTION%ROWTYPE;
PROCEDURE REFCUR_NHM_TRANSACTION (
IN_sTMPACC IN string,
IN_sITEM_TYPES IN string,
OUT_TRANS OUT TRANS_TableRows);
END PACK_REFCURSOR_NHM_TRANSACTION ;

/
-- the above works fine
--but this one below has the error when
CREATE OR REPLACE PACKAGE BODY PACK_REFCURSOR_NHM_TRANSACTION AS
PROCEDURE REFCUR_NHM_TRANSACTION (
IN_sTMPACC IN string,
IN_sITEM_TYPES IN string,
OUT_TRANS OUT TRANS_TableRows) IS
BEGIN

OPEN OUT_TRANS FOR
SELECT T.TRANSACTION_ID, T.TRANSACTION_TYPE, T.TRANSACTION_DATE,
T.TRANSACTION_TIME,
T.ITEM_CODE, 0 OE_DETAIL_ID,
T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE, T.GST_AMOUNT,
'I'INSURER_TYPE
FROM NHM_TRANSACTION T
WHERE DISPENSED_FLG = 'Y'
AND T.ACCOUNT_ID = IN_sTMPACC
AND T.TRANSACTION_TYPE IN ('01','02', '09')
AND NVL(T.STATUS,'F') != 'C'
AND T.BILLED_FLG = 'N'
AND T.ITEM_TYPE IN (IN_sITEM_TYPES)
AND T.BILL_ITEM_FLG = 'Y'
UNION ALL
SELECT T.OE_TRANSACTION_ID TRANSACTION_ID, TRANSACTION_TYPE,
T.TRANSACTION_DATE,
T.TRANSACTION_TIME, NVL(T.ITEM_CODE,T.PACKAGE_CODE) ITEM_CODE,
T.OE_DETAIL_ID,
T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE, T.GST_AMOUNT, 'S'
INSURER_TYPE
FROM NHC_OE_TRANSACTION T, NHC_MASTER_ITEM M, NHM_PACKAGE P
WHERE T.ACCOUNT_ID = read more about Oracle stored proc problem


Message from emmim44
Most recent post: 10/22/2007
3 authors and 4 replies.

Error while trying to find the difference btw 2 days excluding weekends...I am
using oracle 10g with MX 8

[Macromedia][Oracle JDBC Driver][Oracle]ORA-00904: "DATENAME": invalid
identifier

The error occurred in /apps/www/html/ITS_REQ/ITS_REQStat.cfm: line 9

7 :
8 : <body>
9 : <CFQUERY name="c1" datasource="#FormVector#">
10 : Select
11 : (DATEDIFF(dd, ITSSEC_TO_ITSDIR, ITSSEC_TO_BA) + 1)



--------------------------------------------------------------------------------

SQL Select (DATEDIFF(dd, ITSSEC_TO_ITSDIR, ITSSEC_TO_BA) + 1)
-(DATEDIFF(wk, ITSSEC_TO_ITSDIR, ITSSEC_TO_BA) * 2) -(CASE WHEN DATENAME(dw,
StartDate) = 'Sunday' THEN 1 ELSE 0 END) -(CASE WHEN DATENAME(dw, EndDate) =
'Saturday' THEN 1 ELSE 0 END) AS TotalWorkDays from REQ_FOR_SUPPANDSERV where
EXTRACT(YEAR FROM ITSSEC_TO_ITSDIR )='2007' read more about DATENAME": invalid identifier


Message from tracjerian
Most recent post: 10/22/2007
4 authors and 5 replies.

I have a query that needs to pull data between a date range. I have tried several
things and nothing seems to work.
Any help'd be greatly appreciated.

Here's the code:

<CFTRANSACTION>
<CFQUERY name="QryFollowUp" datasource="NBProdReports">
SELECT TblContractInfo_SubMenuTable.User_ID,
TblContractInfo_SubMenuTable.Contract_Number,
TblContractInfo_SubMenuTable.Transaction_Type,
TblContractInfo_SubMenuTable.Notes,
TblContractInfo_SubMenuTable.Num_Checks_Trans, TblMasterTrans.Date_Opened
from TblContractInfo_SubMenuTable ,tblMasterTrans
WHERE Transaction_Type = 'FollowUp'
And TblContractInfo_SubMenuTable.Task_Number = tblMasterTrans.Task_Number
And TblMasterTrans.Date_Opened BETWEEN #form.StartDate# AND #form.EndDate#
ORDER BY TblMasterTrans.Date_Opened ASC, TblContractInfo_SubMenuTable.User_id
ASC
</CFQUERY>

</CFTRANSACTION> read more about query problem with date range


Message from Mattastic
Most recent post: 10/22/2007
2 authors and 2 replies.

Can anyone help me undetstand this query:

SELECT f.*, d.*, z.*
FROM content d INNER JOIN FREETEXTTABLE(content, *, '"#searchtext#"') f ON
d.pageid
= f.[Key]
ORDER BY rank DESC

I need to join another table, but I dont get how the query works.

Thankyou read more about Query problem


Message from advancemal
Most recent post: 10/21/2007
3 authors and 5 replies.

I come from a desktop development background with products like
access/filemaker etc. I am used to easily dropping calculated fields on forms
to do things like calculate invoice totals, tax amounts etc... Is there any
similar way of doing this on Cold Fusion page. These'd need to dynamicaly
change on the client side as other fields on the form change. I honestly cant
see how to do this and the only possible solution I can think of is to have a
complex JAVAscript function to do all the calculations each time the form
onchange() event is fired, any ideas'd be greatly appreciated. read more about Calculated Form Fields


Message from Kapman78
Most recent post: 10/21/2007
5 authors and 14 replies.

I think one is a duesy, but I hope someone has some insight, thanks is advance
for any attempt.

I have a bookmaking website that opens other websites in a frame. Within the
frame I have a links that tie into the database so they can add it as a
favorite or rank the site. The problem is some sites wont work, about 80% do,
but there are a couple that give me the error below. I'm assuming they have
some kind of frame blocker or something. Let me know, thanks!

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver]Numeric value out of range (null)

Please try the following:
? Enable Robust Exception Information to provide greater detail about the
source of errors. In the Administrator, click Debugging & Logging > Debugging
Settings, and select the Robust Exception Information option.
? Check the Cold Fusion documentation to verify that you are using the correct
syntax.
? Search the Knowledge Base to find a solution to your problem.

Here is a link to a non-working:
http://www.busswire.com/frame2.cfm?CFID=141904&CFTOKEN=14129363

working: http://www.busswire.com/frame2.cfm?CFID=141904&CFTOKEN=14129363

Thanks read more about Frame works in some websites, not others


Message from Nightfall_Blue
Most recent post: 10/20/2007
2 authors and 2 replies.

I have recently installed CF8b on my Vista laptop with SQL2005 and IIS7 and of
course nothing seems to work.

My data sources verify but my application doesnt run at all. It just times
out.

I tried to run a test.CFM page, but my browser wont run it and goes to
index.cfm...... so I renamed my index.CFM to something else and renamed a
test.CFM to index.cfm. I have no idea why It wont run anything other than
idex.cfm... but anyway. I then run the index.CFM

This page is a BASIC page..nothing to it.

This query takes OVER ONEMINNUTE to run under CF8b and sql2005.

<CFQUERY name="this_fuse" datasource="databasename">
SELECT
ID, S_ID, Name, Action, name2, Desc,
FROM dbo."items"
</CFQUERY>

This one doesnt run at all. IOt just tmes out. and the variable names are
perfect. although these arnte h queries themselves, tthe queries I'm running
were taken from files that work under CF7

<CFQUERY name="name" datasource="databasename">
SELECT
ID, S_ID, Name, Action, name2, Desc, behaviour
FROM dbo."items"
</CFQUERY> I have run the full queries in sql2005 Management Studio and they run
instantly. yet CF8 cannot connect to them properly. I know its in its beta
stages but surely this isn'thing new. What could I be missing here? I am absolutely flummoxed read more about CF8 and SQL2005 on Vista Home Premuim