ColdFusion ODBC errors

There are two general classes of ODBC errors:

1) When ODBC attempts to connect to the datasource specified in the Cold Fusion application.
2) Happens when a SQLstatement passed to ODBC by Cold Fusion contains a syntax error.

The general form of an ODBC error message returned by Cold Fusion is:

ODBC Error Code = [error code] [(error message) ]

Hint: [a description of the possible cause(s) of the problem and recommended solution(s).]

SQL= "[sql statment of the CFQUERY that caused the problem]"

Data Source = [datasource specified in CFQUERY that caused error]

Here are some examples of ODBC errors and tips on how to troubleshoot them.

Error: Datasource cannot be found

Cold Fusion uses ODBC to communicate with a variety of databases. Before you can use a database in a Cold Fusion Application, the Cold Fusion Administrator must create and register a data source. Each data source registered with Cold Fusion is assigned a unique name. The above error message occurs when a Cold Fusion application refers to a datasource that has not been registered with Cold Fusion.

A datasource can be created only by the Cold Fusion Administrator. You can request a datasource to be created for you by contact the webserver administrator. If a datasource has already been created for you, make sure that you use the name assigned to your datasource and that you spell it correctly.

Error: Couldn't find file '(unknown)'.

Cold Fusion could not find the database file specified by the datasource name used in a query. Common causes of this error are: * You have changed the location of your datasource (the database file) by either moving it or renaming one of its parent directories or * you have renamed the database defined by the datasource.

If you want to change the location of the datasource, notify the ColdFusion Administrator of the new location. Otherwise, make sure that the datasource is returned to the location where it resided when first defined.

Error: Can't open datasource because database not recognized or file may be corrupt.

Typically, this error is seen only when the datasource is a file-based database such as Access or Fox. The ODBC cannot open the database specified by the datasource name because database file has been either:

* replaced by database that ODBC does not recognize,
* accidentally overwritten with an empty file, or
* become corrupted because a database operation terminated without closing the database. The commonly happens when the disk quota on your home directory is exceeded while a FTP or a database insert is in progress

If you have accidentally overwritten your database file, you must either ftp a backup copy from your local workstation to the production webserver. If you do not have a backup copy, request that the most recent copy of the database file be restored from the backup on the webserver.

If the damage occurred because you exceeded your disk quota, you must first request additional disk quota on the server. Only after your disk quota has been increased can you restore your database.

Error: Wrong number of parameters

An SQL statement referenced a field name that does not exist in the datasource. Check the SQL statement or query listed with this message and verify that:

* you are using the correct datasource with the query, and
* the fields exist and that you have spelled their names correctly, and
* any literals or strings in the query are enclosed in single quotes (').

Error: Syntax error or access violation

A CFQUERY tag contained a SQL statement that

* contained a syntax error, or
* violated the security restrictions of the datasource.

Check the full error message to see if the problem was caused by a syntax error or an access violation. With syntax errors, the message attempts to pinpoint the source of the error.

Add Feedback