Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Error Code = IM002 ----- HELP!!!!!

Status
Not open for further replies.

nalbiso

Programmer
Aug 31, 2000
71
US
HELP!

I am new to ColdFusion and I am attempting to create an ODBC Datasource. I have created it through the ColdFusion Administrator and it verified successfully. But when I go to the webpage I get this error:


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

Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = IM002 (Data source not found and no default driver specified)


[Microsoft][ODBC Driver Manager] Data source 'staff2' not found and no default driver specified

Hint: In order to use ODBC data sources with Cold Fusion you must create the data source using the Data Sources page of the Cold Fusion Administrator. In addition, if you are running under Windows NT you must make sure that the Data Source is created as a System DSN in order for it to be available to ColdFusion.


Data Source = "staff2"

SQL = ""

Data Source = "staff2"


The error occurred while processing an element with a general identifier of (CFINSERT), occupying document position (1:1) to (1:53) in the template file d:\Inetpub\

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

Has anyone out there ever come across this error before and if so, how did you fix it?

Any help is greatly appreciated.

Thank you.
 
Nalbiso, personally I don't like the CFINSERT and CFUPDATE tags, they are inferior to writing your own queries within a cfquery block, especially because cfquery gives you much more control over what you want to do.
A cfquery block should look like this (in case you already know it, use it! :) ):

<CFQUERY name=&quot;MyQuery&quot; datasource=&quot;MyDSN&quot;>
INSERT INTO MyTableName
(Column1, Column2, Column3)
VALUES
('#FORM.var1#', '#FORM.var2#', #FORM.var3#
</CFQUERY>

Make sure to put single quotes around strings, and no quotes around numeric values you use in your query.
Write out your full query, and if it doesn't work, give me some details and post again. Good luck!



<webguru>iqof188</webguru>
 
I have tried that too. I still get the same error, it just replaces CFInsert with CFQuery in the error message.
 
This could be an NT permissions error. Check the permissions on the database itself. &quot;System&quot; should have full (or at least read/write) access to the file.

System is the Operating System &quot;user&quot; it also the one that Cold Fusion uses.

Hope this helps
 
-> did you test the connection in the cf admin ??? when you click &quot;verify&quot; does it say &quot;yes i found your database&quot; ?
-> did you verify it as well in the administration tool of windows (where you can add data source names and map them) ??

if the answer to both of the questions is YES then you have a problem with the cfinsert code and should consider iqof's solution

if one of the answer is NO then you know what to do to fix it now !!! make the answers to be yes ;-)
 
Hi everyone.

Thank you for trying to help me. I am still stuck. I am not sure how to &quot;map&quot; the datasources. If you set them up and they verify, doesn't that already establish the path? I was an ASP person before and then I just had to establish the ODBC connection in the windows setting and I could go on about my work

I have checked permissions and everything says full control all. I verified the database, it checked out ok I have tried the following Code:
--------------------------------------------------------------------------------------------------

<cfoutput>
<cfTransaction>
<cfquery name=&quot;InsertNewValues&quot; datasource=&quot;Website&quot; dbtype=&quot;ODBC&quot;>
INSERT INTO SSDPCalendarofEvents (Date, NameofEvent, Description, Time, Contact, Location)
VALUES ( '#FORM.Date#', '#FORM.NameofEvent#', '#FORM.Description#', '#FORM.Time#', '#FORM.Contact#', '#FORM.Location#' )
</cfquery>
</cftransaction>

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<title>Calendar Update</title>
</head>
<tr>
<td colspan=&quot;2&quot;>You have added the following information:</td>
<td>Date: '#FORM.Date#'</td>
<td>Name of Event: '#FORM.NameofEvent#'</td>
<td>Description: '#FORM.Description#'</td>
<td>Time: '#FORM.Time#'</td>
<td>Contact: '#FORM.Contact#'</td>
<td>Location: '#FORM.Location#'</td>
</tr>
</body>
</html>
</cfoutput>

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

And I still get the error:

--------------------------------------------------------------------------------------------------
Error Diagnostic Information

ODBC Error Code = IM002 (Data source not found and no default driver specified)

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Hint: In order to use ODBC data sources with Cold Fusion you must create the data source using the Data Sources page of
the Cold Fusion Administrator. In addition, if you are running under Windows NT you must make sure that the Data Source
is created as a System DSN in order for it to be available to ColdFusion.

Data Source = &quot;Website&quot;

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position
(3:1) to (3:67) in the template file d:\Inetpub\
Date/Time: 03/01/01 09:45:57
Browser: Mozilla/4.72 [en] (WinNT; I)
Remote Address: 206.208.132.18
HTTP Referer: --------------------------------------------------------------------------------------------------

The guy that was here before me actually had everything pointing to a database with one table of his predefined global variables. I don't know how he did it or what I should to to change it. But would this effect what I am doing?

Any assistance is greatly appreciated. :)
 
This may sound silly but it might be the crux of the problem. When you name the datasource in the CFquery tag, are you using the same name that is in the CF Administrator.

IE: if you set up a datasource in CFADMIN called &quot;ds1&quot;, you have to call it in the CF query statement

<cfquery name=&quot;blah&quot; datasource=&quot;ds1&quot;>
SQL STATEMENT
</cfquery>

hope this helps

 
Hi Scooter,

Yes I referenced the datasource using the same name, &quot;Website&quot; in both the Admin and the Query.
 
One more, this is the last thing I can think of and this is a long shot. If it's an Access DB, there can be &quot;workgroup&quot; access set on the DB. It's a security measure that requires a user to be a member of a specific workgroup to make changes/updates to the DB. (there's a utility in Access called WRKGADM.exe that users can &quot;log in&quot; to the DB from)

By default this is set to the Administrative account on the machine housing the website.

See if this is active on the particular DB (I think this should throw a different error, somthing like no read access but it's worth a shot)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top