>
> I was contacted by Mark C. in the mail below and followed his
> suggestion and the problem cleared up. I can only assume
> that something in the underlying database changed in the past
> few days and something that worked before stopped working (a
> first in software, eh?).
What that does (the default bind type) is to make DBD::ODBC assume
everything is a varchar and the database/ODBC driver has to do all the type
conversion. That can be handy, but I'm surprised that you'd get a rebind
error. If you send me a trace (level 9) from the statement before and
after, the "fix", I'd be very curious (but I'm backed up at the moment so it
will go near the bottom of my list, since it's working).
>
> Anyway, I started to see a new error about the statement
> failing due to another statement handle being active. I
> looked through my code and did not find any executing
> statement handles, but did find two others that had been
> prepared. I was able to solve the issue by moving the
> prepare statements inside the loop instead of preparing
> outside the loop. Less efficient, but it works.
Is there a chance that one of the statements had an execute run, but you
didn't get all the rows, somewhere in the loop? I.e. (using short hand)
$sth1 = prepare
$sth2 = prepare
Loop begin
execute $sth1
get all rows from $sth1
execute sth2
while (some condition and $sth2->fetchrow) {
}
# some condition goes false, but $sth2 has not finished fetching all
rows???
# next time through the loop, $sth2 would still be executing...???
Loop end
Regards,
Jeff
>
> This multistatement handle issue was raised as one of the key
> issues with DBI::ODBC in the DBI book. It wasn't clear to me
> as to how the underlying database dealt with this. Is it the
> case that even a prepared handle would conflict with a new handle?
>
> Many thanks.
>
> Bernard Golden
>
> -----Original Message-----
> From: Mark C [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 02, 2003 10:30 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Rebinding variable error
>
>
> Here is something that I had to do in order to get my code to
> work with a newer DBD::ODBC version. See
> $dbh->{odbc_default_bind_type} = 12
>
> If this solves your problem, please post the group..
>
> Mark
>
>
> ################### Build DSN Less MSSQL Connection
> Parameters ### my $DSN = 'driver={SQL
> Server};Server=markchar; database=orders; uid=orderguy;
> pwd=xxxxx;'; my $dbh = DBI->connect("dbi:ODBC:$DSN")
> or die "Can't connect to databese ",
> DBI::errstr," \n";
> ##############################################################
> ###########
> print "We have connected successfully to the SupportDB
> Database \n"; $dbh->{AutoCommit} = 0; # Turn off Auto
> Commit, we will do it manually $dbh->{RaiseError} = 1; # let
> DBI handle the call to die $dbh->{odbc_default_bind_type} =
> 12; # SQL_VARCHAR for
> # May 18, 2003 compatibility with older
> DBD::ODBC
> # $dbh->{odbc_default_bind_type} = 0; # **DEFAULT won't work here***
>
>
> -----Original Message-----
> From: Bernard Golden [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 02, 2003 10:16 AM
> To: [EMAIL PROTECTED]
> Subject: Rebinding variable error
>
>
> Help!
>
> I am getting the following error code:
>
> C:\Temp\Kaiser\kaisersubscribersoapclient.pl: Failed: Can't
> rebind placeholder 8 at c:/Perl/lib/Subscriber.pm line 795,
> <DATA> line 164.
>
> with the following code:
>
> my $substh = $dbh -> prepare(
> "INSERT INTO ktc_subscriptions ( subscription_id,
> contact_id, org_id, subscription_item_id, subscription_status_id,
> create_date, source_id, created_by_user_id)
> VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)" )
> or error_handler ("Register Subscription Insert
> prepare failed, $DBI::err ($DBI::errstr)", __LINE__);
> my $subs = $substh -> execute(
> "$sub->{subscription_id}", "$sub->{contact_id}",
> "$sub->{organization_id}", "$sub->{subscription_item_id}",
> "$sub->{subscription_status_id}",
> "$sub->{create_date}",
> "$sub->{registration_source}","$sub->{created_by_user_id}" )
> or error_handler ("INSERT Subscription information
> failed, $DBI::err ($DBI::errstr)", __LINE__);
>
> I am getting the rebind error, but not the error_handler
> error call, so it appears that somewhere below my code the
> error is being thrown and the program exiting before my error
> handler gets a chance to run.
>
> I tested this code last week and it was working. It is
> possible the underlying database changed in the intervening
> time; however, all of the columns still exist.
>
> The underlying database is MS SQLServer and I am using
> DBI:ODBC as the interface.
>
> Any insights into what is causing the problem would be very
> appreciated.
>
> TIA.
>
> Bernard Golden
>
>
>
>
>
>
>
>