Informix OLE DB provider + local transactions?
Posted in 2007
A C#/.NET user got "The ITransactionLocal interface is not supported by the 'Ifxoledbc.3' provider" when calling IDbConnection.BeginTransaction(). The misleading message actually meant the database had no transaction logging (dbaccess also returned error 256 on BEGIN WORK). The fix: enable logging with 'ontape -s -U <dbname>', which requires a level-0 archive. On Windows this meant editing ONCONFIG's TAPEDEV (to NUL or a file path such as D:\\Informix\\backup.bak) and raising TAPESIZE so the backup fits one "tape". After that, BeginTransaction() worked; the poster posted a step-by-step summary.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Hi, In the IBM Informix OLE DB provider programmer's guide, it is said that the provider implements the ITransactionLocal interface. However, when I try to use it in my C#.NET code, I get the following error message: The ITransactionLocal interface is not supported by the 'Ifxoledbc.3' provider. Local transactions are unavailable with the current provider. I tried to change the provider to Ifxoledbc.2 but I got the same error message. So, am I doing something wrong? Or the provider doesn't really implement the interface? My code is something like this: using System.Data; private IDbTransaction m_Transaction; //this variable is successfully initialized somewhere... private readonly IDbConnection m_Connection; public void startTransaction() { m_Transaction = m_Connection.BeginTransaction(); //throws exception!!! } Thanks in advance!
Might want to post to the "development tools" list for a wider audience. Not sure of the email address but it's available via www.iiug.org Bob Roussey Unix / Informix Administration Spirit Airlines Robert.Roussey@SpiritAir.com -----Original Message----- From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of MARCIO ALBUQUERQUE Sent: Tuesday, October 16, 2007 3:32 PM To: ids@iiug.org Subject: Informix OLE DB provider + local transactions? [10158] Hi, In the IBM Informix OLE DB provider programmer's guide, it is said that the provider implements the ITransactionLocal interface. However, when I try to use it in my C#.NET code, I get the following error message: The ITransactionLocal interface is not supported by the 'Ifxoledbc.3' provider. Local transactions are unavailable with the current provider. I tried to change the provider to Ifxoledbc.2 but I got the same error message. So, am I doing something wrong? Or the provider doesn't really implement the interface? My code is something like this: using System.Data; private IDbTransaction m_Transaction; //this variable is successfully initialized somewhere... private readonly IDbConnection m_Connection; public void startTransaction() { m_Transaction = m_Connection.BeginTransaction(); //throws exception!!! } Thanks in advance! ************************************************************************ ******* Forum Note: Use "Reply" to post a response in the discussion forum.
Please copy paste the full testcase (your program) in the mail. Also mention the CSDK version which your using. Regards, Prem "MARCIO ALBUQUERQUE" <marcio.albuquerque@atan.com.br> Sent by: ids-bounces@iiug.org 17/10/2007 01:01 Please respond to ids@iiug.org To ids@iiug.org cc Subject Informix OLE DB provider + local transactions? [10158] Hi, In the IBM Informix OLE DB provider programmer's guide, it is said that the provider implements the ITransactionLocal interface. However, when I try to use it in my C#.NET code, I get the following error message: The ITransactionLocal interface is not supported by the 'Ifxoledbc.3' provider. Local transactions are unavailable with the current provider. I tried to change the provider to Ifxoledbc.2 but I got the same error message. So, am I doing something wrong? Or the provider doesn't really implement the interface? My code is something like this: using System.Data; private IDbTransaction m_Transaction; //this variable is successfully initialized somewhere... private readonly IDbConnection m_Connection; public void startTransaction() { m_Transaction = m_Connection.BeginTransaction(); //throws exception!!! } Thanks in advance! ******************************************************************************* Forum Note: Use "Reply" to post a response in the discussion forum.
Thank you for your response.
I'm using the CSDK 3.0. My code is REALLY BIG, I'll try to write a short
version and post it here.
I'm still a novice in Informix. Maybe this error has something to do with
this: when I try to run the SQL
begin work;
in the database using dbaccess, I get the error
256: Transaction not avaidable.
I also tried to run
start database stores_demo with log in 'C:\\\\stores_demo.log'
But then I get the error
325: Filename must be specified with a full path name.
Any ideas?
Hi,
If transaction is not available, you should enable transaction logging
on the db.
Set TAPEDEV to /dev/null in onconfig temporarily and execute ontape -s
-U <dbname>. This adds logging to a database (and capability to support
transactions).
Marcus
-----Original Message-----
From: MARCIO ALBUQUERQUE [mailto:marcio.albuquerque@atan.com.br]
Sent: Wednesday, October 17, 2007 4:51 PM
To: ids@iiug.org
Subject: Re: Informix OLE DB provider + local transactions? [10169]
Thank you for your response.
I'm using the CSDK 3.0. My code is REALLY BIG, I'll try to write a short
version and post it here.
I'm still a novice in Informix. Maybe this error has something to do
with
this: when I try to run the SQL
begin work;
in the database using dbaccess, I get the error
256: Transaction not avaidable.
I also tried to run
start database stores_demo with log in 'C:\\\\stores_demo.log'
But then I get the error
325: Filename must be specified with a full path name.
Any ideas?
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
Hi,
Thank you for your help. I'm sorry but now I'm going to make a really newbie
question. Sorry but I couldn't find the answer yet.
The problem is: I am using Windows. How do I do a level-0 archive using
Windows? When I try to use ontape, I get the message:
Please mount tape 1 on \\\\\\\\.\\\\TAPE0
But I just don't know how to do such a thing in Windows!
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> MARCIO ALBUQUERQUE
> Sent: Wednesday, October 17, 2007 12:59 PM
> To: ids@iiug.org
> Subject: Re: RE: Re: Informix OLE DB provider + local t.... [10180]
>
> Hi,
>
> Thank you for your help. I'm sorry but now I'm going to make a really
> newbie
> question. Sorry but I couldn't find the answer yet.
> The problem is: I am using Windows. How do I do a level-0 archive
using
> Windows? When I try to use ontape, I get the message:
>
> Please mount tape 1 on \\\\\\\\.\\\\TAPE0
>
> But I just don't know how to do such a thing in Windows!
Edit your onconfig file and change this entry:
TAPEDEV \\\\\\\\.\\\\TAPE0 # Tape device path
To something like:
TAPEDEV C:\\\\myfile.bak # Tape device pathOr
TAPEDEV \\\\\\\\myserver\\\\mysharepoint\\\\myfile.bak # Tape
device path
Then you can have this file backed up with your regular windoze backup
job. You can also use onbar to link in a backup server system like
Veritas, etc. For more info see the backup and recovery manual.
--EEM
>
>
>
************************************************************************
**
> *****
> Forum Note: Use "Reply" to post a response in the discussion forum.
Thank you! I think we're almost there...
I did what you told me and here's what happened:
------------------------------------------------------------------------------
D:\\\\Informix>ontape -s -U stores_demo
Please enter the level of archive to be performed (0, 1, or 2) 0
Please mount tape 1 on D:\\\\Informix\\\\backup.bak and press Return to continue ...
10 percent done.
Tape is full ...
Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:
6
Please mount tape 2 on D:\\\\Informix\\\\backup.bak and press Return to continue ...
warning: previous tape is still mounted!
------------------------------------------------------------------------------
Now now the question is: is there any way to make my tapes bigger so that
everything fits in one tape? My file backup.bak became full with only 10 MB,
but I have gigabytes of free space.
Or, if I can't make the tapes bigger, how do I label the tape as number 1,
unmount it, and mount tape 2?
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> MARCIO ALBUQUERQUE
> Sent: Wednesday, October 17, 2007 2:11 PM
> To: ids@iiug.org
> Subject: Re: RE: RE: Re: Informix OLE DB provider + loc.... [10183]
>
> Thank you! I think we're almost there...
> I did what you told me and here's what happened:
>
>
------------------------------------------------------------------------
--
> ----
> D:\\\\Informix>ontape -s -U stores_demo
> Please enter the level of archive to be performed (0, 1, or 2) 0
>
> Please mount tape 1 on D:\\\\Informix\\\\backup.bak and press Return to
continue
> ...
>
> 10 percent done.
> Tape is full ...
>
> Please label this tape as number 1 in the arc tape sequence.
> This tape contains the following logical logs:
>
> 6
>
> Please mount tape 2 on D:\\\\Informix\\\\backup.bak and press Return to
continue
> ...
>
> warning: previous tape is still mounted!
>
------------------------------------------------------------------------
--
> ----
>
> Now now the question is: is there any way to make my tapes bigger so
that
> everything fits in one tape? My file backup.bak became full with only
10
> MB,
> but I have gigabytes of free space.
> Or, if I can't make the tapes bigger, how do I label the tape as
number 1,
> unmount it, and mount tape 2?
You need to set this parameter as well:
TAPESIZE 8000000 # Maximum amount of data to put on tape
(Kbytes)
Remember that Windoze limits you to 2 gigs if memory serves. You can
"mount tapes" by renaming the file and creating a new one with the same
name.
--EEM
>
>
>
************************************************************************
**
> *****
> Forum Note: Use "Reply" to post a response in the discussion forum.
Problem solved!
I'd like to thank everybody that helped and made me learn about Informix.
Here's the step-by-step of how to make local transactions work with the OLE DB
provider, using Windows. My problem was: the method
BeginTransaction() defined in the interface System.Data.IDbConnection was
throwing an Exception, with the message
"The ITransactionLocal interface is not supported by the 'Ifxoledbc.3'
provider. Local transactions are unavailable with the current provider"
Don't worry about the message, it is wrong. As said in the IBM Informix OLE DB
provider programmer's guide, the ITransactionLocal interface is implemented.
The problem probably is that transactions are not available in your database.
To solve the problem:
- Enable transaction logging on the DB. To do this, you have to run the command
ontape -s -U <dbname>
This command will create a backup and enable unbuffered logging. To use
transactions, you have to enable logging; and to enable logging, you have to
create a level-0 backup.
The ontape command will first ask you the level of archive, enter 0. Then it
will ask you to mount a tape to store the backup. The location in which it
asks you to mount the tape is defined in the TAPEDEV line of the ONCONFIG file
of the server instance you are using. This file is located in INFORMIXDIR\\\\etc.
Here you have two options: set a file to be the backup tape (if you haven't
already), or just temporally set TAPEDEV to null (if you're not interested in
the backup, just want to enable logging). You have to edit the following lines
of the ONCONFIG file:
-To set TAPEDEV to null:
TAPEDEV NUL (if you're using Windows, in Unix it would be TAPEDEV /dev/null)
-Or, if you want to mount the tape in a file:
TAPEDEV D:\\\\Informix\\\\backup.bak (or any other file path you want)
TAPESIZE 10240 (you may want to increase this number to make your level-0
backup fit in one tape (file). Maximum size is 8000000 (8 GB)).
After editing the ONCONFIG file, the ontape command should work, enabling
logging and, therefore, transactions. To test if transactions are working, you
can open dbaccess and run the SQL:
BEGIN WORK
If transactions are working you will get the message "Started Transaction".
Now that transactions are working, the method BeginTransaction() shouldn't
throw Exception anymore.
I hope this helps other Informix newbies like me!
Warn me if I said something wrong!
This information will be helpful to me. Thanks for summarizing.
Mike
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On
> Behalf Of MARCIO ALBUQUERQUE
> Sent: Thursday, October 18, 2007 10:10 AM
> To: ids@iiug.org
> Subject: Problem solved: Informix OLE DB provider + loc.... [10200]
>
> Problem solved!
> I'd like to thank everybody that helped and made me learn
> about Informix.
> Here's the step-by-step of how to make local transactions
> work with the OLE DB provider, using Windows. My problem was:
> the method
>
> BeginTransaction() defined in the interface
> System.Data.IDbConnection was throwing an Exception, with the message
>
> "The ITransactionLocal interface is not supported by the
> 'Ifxoledbc.3'
> provider. Local transactions are unavailable with the current
> provider"
>
> Don't worry about the message, it is wrong. As said in the
> IBM Informix OLE DB provider programmer's guide, the
> ITransactionLocal interface is implemented.
> The problem probably is that transactions are not available
> in your database.
> To solve the problem:
>
> - Enable transaction logging on the DB. To do this, you have
> to run the command
>
> ontape -s -U <dbname>>
> This command will create a backup and enable unbuffered
> logging. To use transactions, you have to enable logging; and
> to enable logging, you have to create a level-0 backup.
> The ontape command will first ask you the level of archive,
> enter 0. Then it will ask you to mount a tape to store the
> backup. The location in which it asks you to mount the tape
> is defined in the TAPEDEV line of the ONCONFIG file of the
> server instance you are using. This file is located in
> INFORMIXDIR\\\\etc.
> Here you have two options: set a file to be the backup tape
> (if you haven't already), or just temporally set TAPEDEV to
> null (if you're not interested in the backup, just want to
> enable logging). You have to edit the following lines of the
> ONCONFIG file:
>
> -To set TAPEDEV to null:
>
> TAPEDEV NUL (if you're using Windows, in Unix it would be
> TAPEDEV /dev/null)>
> -Or, if you want to mount the tape in a file:
>
> TAPEDEV D:\\\\Informix\\\\backup.bak (or any other file path you
> want) TAPESIZE 10240 (you may want to increase this number to
> make your level-0 backup fit in one tape (file). Maximum size
> is 8000000 (8 GB)).
>
> After editing the ONCONFIG file, the ontape command should
> work, enabling logging and, therefore, transactions. To test
> if transactions are working, you can open dbaccess and run the SQL:
>
> BEGIN WORK
>
> If transactions are working you will get the message "Started
> Transaction".
> Now that transactions are working, the method
> BeginTransaction() shouldn't throw Exception anymore.
> I hope this helps other Informix newbies like me!
> Warn me if I said something wrong!
>
>
> **************************************************************
> *****************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
>