Solved

ODBC Error

Posted on 2008-06-23
9
807 Views
Last Modified: 2013-12-25
I am a perl developer and I recently came accross this error.  It is not a consistent error and I have tried strenuosly to recreate it without success.  If anyone can help here it would be greatly appreciated, I am basicly looking for what causes the problem and of coarse what to do in order to correct it.
0
Comment
Question by:harumb
  • 4
  • 4
9 Comments
 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21851468
What does your code look like? Are you perhaps querying the db and instead of checking to see if you actually got a record/result, you are assuming that you did and dereferencing non-existent records? Test for the existence of records before you actually attempt to dereference the resource.
0
 
LVL 14

Assisted Solution

by:Jagdish Devaku
Jagdish Devaku earned 50 total points
ID: 21853749
Hi,

Please refer to the following links which might help you...

http://support.microsoft.com/kb/110093

http://msdn.microsoft.com/en-us/library/ms710252(VS.85).aspx

all the best...
0
 

Author Comment

by:harumb
ID: 21855576
JagdishDevaku,

Thank you for the links but I am looking for specific causes for the error:

Describe failed during DBI::st=HASH(0x2dac6d0)->FETCH(NAME,0) at f:/Perl/site/lib/Win32/DBIODBC.pm line 172.

Of coarse the hex hash value would change.  I have been able to recreate this error after starting my application then disconnecting the database but so far that is the only way I have been able to re-create it.
0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21855744
Once again, what does your code look like? If I had to guess, you are dereferencing invalid object properties/methods.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:harumb
ID: 21856136
hielo,

It is difficult to almost pin down the actual statement but I don't believe the object is invalid.  The method throwing the exception it being referenced by the object.   I have pasted the routine below where we think the error message originated from.

my $DBER = $DB->Sql(
                "SELECT number FROM hst WHERE site=$MSH_SITE AND
                acctnum='".$fields->{'acctnum'}."");
        $DB->FetchRow();

if($DB->Data('number') gt ' ') ...

This is one of our issues, for updates and inserts we do a check for a DBI error but with selects we don't.

hielo,

Have you seen this issue before?

Thanks.

Brad

0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21856553
>>Have you seen this issue before?
Not identical (message wise) but very similar. We were having dns issues and there were times when the scripts were not able to find the server, so there was no active connection.

What does this refer to?
DBIODBC.pm line 172.
0
 

Author Comment

by:harumb
ID: 21856798
hielo,

Whoops I should mention that dbiodbc.pm is a rewrite of the odbc.pm we did.  All the functionality is still there in fact I attached it for you.  The main method though "FETCH" is not in the dbiodbc.pm module but is in the DBI.pm module.  If you saw this before from a dns problem, was it exactly like this error?  The system this error appeared on was using localhost for the odbc dsn server configuration setting.  Normally we don't do that this is just a test system I was on.

thanks.

Brad
DBIODBC.txt
0
 
LVL 82

Accepted Solution

by:
hielo earned 450 total points
ID: 21857583
above you have:
my $DBER = $DB->Sql(
                "SELECT number FROM hst WHERE site=$MSH_SITE AND
                acctnum='".$fields->{'acctnum'}."");
which is missing a closing apostrophe for acctnum='...'

other than that, the attached file has:
sub Sql
{
       my $self= shift;
       my $Sql = shift;
...
since in $DB->Sql('...') you are passing only one argument, the query string, I am wondering if those two lines should be reversed:
sub Sql
{
       my $Sql = shift;
       my $self= shift;
0
 

Author Closing Comment

by:harumb
ID: 31469976
Hielo,

Thank you for your help on this, i put a fix in place and havent seen this error in a week now but I am recoding my selects to account for this.  If it pops back up I will have to re-post again.

Thanks.

brad
brad_harum@picis.com
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Merige returns error code when updating 15 51
Copy a row 12 57
Need help with a query 6 67
How to set the row selection as it was prior leaving the datagrid in vb6 3 33
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now