473,560 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS-DTC and .Net client doesn't work with Transaction Required

Hi all,

I've been trying to get a distributed transaction working between a
..Net client and DB2/UDB. I've tried the following combinations:

Client Server
Win 2000 SP4 DB2/UDB Ver 8.2 AIX server
Win 2000 SP4 DB2/UDB Ver 8.2 Win 2000 Server SP4
Win XP SP2 DB2/UDB Ver 8.2 AIX server
Win XP SP2 DB2/UDB Ver 8.2 Win 2000 Server SP4

All with .Net Framework 1.1. I've also tried patching the .Net
framework with SP1.

The code falls over during the connection with the following message:

ERROR [42705] [IBM] SQL1013N The database alias name or database name
"" could not be found. SQLSTATE=42705

When TransactionOpti on.Supported is used, everything works fine.

The code is below. I've omitted the basic IDB2Tester interface and the
console app code that runs the test.
using System;
using System.Data;
using System.Enterpri seServices;
using System.Runtime. InteropServices ;

using IBM.Data.DB2;

namespace Db2ComPlusCompo nent
{
[ Transaction( TransactionOpti on.Required ) ]
[ ClassInterface( ClassInterfaceT ype.None ) ]
[ Guid( "3CBFC57F-9035-4851-8E47-CC26E13D9F53" ) ]
public class DB2Tester : ServicedCompone nt, IDB2Tester
{
private string _connectionStri ng =
"server=THE-SERVER:50000;da tabase=SAMPLE;u ser
Id=db2admin;pwd =thepassword";

public DB2Tester()
{
}

public int ProcessResultSe t()
{
DB2Connection conn = new DB2Connection(
_connectionStri ng );
DB2Command cmd = new DB2Command(
"Select * from administrator.e mployee" );

cmd.Connection = conn;
int rowCount = -1;

try
{
conn.Open();

DataSet ds = new DataSet();

using ( DB2DataAdapter da = new DB2DataAdapter( cmd ) )
{
da.Fill( ds );
}

rowCount = ds.Tables[ 0 ].Rows.Count;
}
catch ( DB2Exception e )
{
Console.Write( "Not working ... {0}{1}",
Environment.New Line, e.Message );
}
finally
{
conn.Dispose();
}

return rowCount;
}
}
}

Thanks in advance,
Christian Maslen

Nov 12 '05 #1
7 2918
How have you configured DB2 for MS DTC? From the error message, I get the
feeling you're using DB2 transaction coordination, but without creating, or
at leasting configuring the transaction database.

"Christian Maslen" <ch************ **@techie.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
Hi all,

I've been trying to get a distributed transaction working between a
.Net client and DB2/UDB. I've tried the following combinations:

Client Server
Win 2000 SP4 DB2/UDB Ver 8.2 AIX server
Win 2000 SP4 DB2/UDB Ver 8.2 Win 2000 Server SP4
Win XP SP2 DB2/UDB Ver 8.2 AIX server
Win XP SP2 DB2/UDB Ver 8.2 Win 2000 Server SP4

All with .Net Framework 1.1. I've also tried patching the .Net
framework with SP1.

The code falls over during the connection with the following message:

ERROR [42705] [IBM] SQL1013N The database alias name or database name
"" could not be found. SQLSTATE=42705

When TransactionOpti on.Supported is used, everything works fine.

The code is below. I've omitted the basic IDB2Tester interface and the
console app code that runs the test.
using System;
using System.Data;
using System.Enterpri seServices;
using System.Runtime. InteropServices ;

using IBM.Data.DB2;

namespace Db2ComPlusCompo nent
{
[ Transaction( TransactionOpti on.Required ) ]
[ ClassInterface( ClassInterfaceT ype.None ) ]
[ Guid( "3CBFC57F-9035-4851-8E47-CC26E13D9F53" ) ]
public class DB2Tester : ServicedCompone nt, IDB2Tester
{
private string _connectionStri ng =
"server=THE-SERVER:50000;da tabase=SAMPLE;u ser
Id=db2admin;pwd =thepassword";

public DB2Tester()
{
}

public int ProcessResultSe t()
{
DB2Connection conn = new DB2Connection(
_connectionStri ng );
DB2Command cmd = new DB2Command(
"Select * from administrator.e mployee" );

cmd.Connection = conn;
int rowCount = -1;

try
{
conn.Open();

DataSet ds = new DataSet();

using ( DB2DataAdapter da = new DB2DataAdapter( cmd ) )
{
da.Fill( ds );
}

rowCount = ds.Tables[ 0 ].Rows.Count;
}
catch ( DB2Exception e )
{
Console.Write( "Not working ... {0}{1}",
Environment.New Line, e.Message );
}
finally
{
conn.Dispose();
}

return rowCount;
}
}
}

Thanks in advance,
Christian Maslen

Nov 12 '05 #2
Mark

Thanks for your response - I'm working with Christian on this issue.
On the server running MS DTC we have the DB2 client configured with
TP_DATABASE="1S T_CONN" and TP_MON_NAME is blank (as per IBM's
documentation for using MTS).

Is there anything else that we need to configure? Do we need to
request specific server side configuration from our DBAs to support
distributed transactions?

Regards
Alistair

Nov 12 '05 #3
<al************ *****@gmail.com > wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Mark

Thanks for your response - I'm working with Christian on this issue.
On the server running MS DTC we have the DB2 client configured with
TP_DATABASE="1S T_CONN" and TP_MON_NAME is blank (as per IBM's
documentation for using MTS).

Is there anything else that we need to configure?
YES. You have to install your code into a COM+ package (or its .NET
equivalent) that is configured for transactions. [MTS is the name under NT4
+ Options Pack, from W2K on, it's called COM+].

The option is called TM_DATABASE, and if you intend to use one, you should
create it and configure it. 1ST_CONN is a lousy default. You would also need
to create and configure your syncpoint manager (SPM_*). The control centre
has a GUI interface for most of this.
Do we need to request specific server side configuration from our DBAs
to support distributed transactions?
YES. You need to enable two phase commit. I strongly recommend your asking
your DBA for assistance.

Regards
Alistair

Nov 12 '05 #4
Sorry about the late reply...
YES. You have to install your code into a COM+ package (or its .NET
equivalent) that is configured for transactions. [MTS is the name under
NT4
+ Options Pack, from W2K on, it's called COM+].
<<

Did this.
The option is called TM_DATABASE, and if you intend to use one, you
should
create it and configure it. 1ST_CONN is a lousy default. You would also
need
to create and configure your syncpoint manager (SPM_*). The control
centre
has a GUI interface for most of this.
<<

This has also been setup. We (the DBA and I) tried TM_DATABASE with a
specific database and 1ST_CONN. When you say create and configure the
syncpoint manager, what do you mean by this? The SPM_NAME has been set
for the instance, and I can't find any DB2 doco that mentions what else
apart from putting in a name is required.

YES. You need to enable two phase commit. I strongly recommend your
asking
your DBA for assistance.
<<

My DBA assures me this has been done.

Regards,
Christian Maslen

Nov 12 '05 #5
SPM_NAME, TM_DATABASE and 1ST_CONN are for DB2-controlled transaction
management. You say you've set these up.

Your question concerned using .NET (COM+) to control the transactions. You
say you've installed your code into COM+.

I suspect that your problems are caused by your confusing these two. You
have to decide what you want, and configure for that.

"Christian Maslen" <ch************ **@techie.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Sorry about the late reply...
YES. You have to install your code into a COM+ package (or its .NET
equivalent) that is configured for transactions. [MTS is the name under
NT4
+ Options Pack, from W2K on, it's called COM+].
<<

Did this.
The option is called TM_DATABASE, and if you intend to use one, you
should
create it and configure it. 1ST_CONN is a lousy default. You would also
need
to create and configure your syncpoint manager (SPM_*). The control
centre
has a GUI interface for most of this.
<<

This has also been setup. We (the DBA and I) tried TM_DATABASE with a
specific database and 1ST_CONN. When you say create and configure the
syncpoint manager, what do you mean by this? The SPM_NAME has been set
for the instance, and I can't find any DB2 doco that mentions what else
apart from putting in a name is required.

YES. You need to enable two phase commit. I strongly recommend your
asking
your DBA for assistance.
<<

My DBA assures me this has been done.

Regards,
Christian Maslen

Nov 12 '05 #6
Hi all,

I've been trying to get a distributed transaction working between a
.Net client and DB2/UDB....


The problem has been fixed. The issue was with the connection string
specifying the server name and port. So instead of:

_ConnnectionStr ing = "server=THE-SERVER:50000;da tab*ase=SAMPLE; user
Id=db2admin;pwd =thepassword";

use:
_ConnnectionStr ing =
"datab*ase=SAMP LE;userId=db2ad min;pwd=thepass word";

I found this by running the LCTrans sample that is installed with the
developer client (I should have tried this first ;o). If anyone knows
why this fix works that would be handy.

Mark,

Thanks again for your help on this.

Christian Maslen

Nov 12 '05 #7
Yes, forcing the connection's server is a demand for an external transaction
manager *not* to be used, as it bypasses the COM+ facilities.

"Christian Maslen" <ch************ **@techie.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Hi all,

I've been trying to get a distributed transaction working between a
.Net client and DB2/UDB....


The problem has been fixed. The issue was with the connection string
specifying the server name and port. So instead of:

_ConnnectionStr ing = "server=THE-SERVER:50000;da tab*ase=SAMPLE; user
Id=db2admin;pwd =thepassword";

use:
_ConnnectionStr ing =
"datab*ase=SAMP LE;userId=db2ad min;pwd=thepass word";

I found this by running the LCTrans sample that is installed with the
developer client (I should have tried this first ;o). If anyone knows
why this fix works that would be handy.

Mark,

Thanks again for your help on this.

Christian Maslen
Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1992
by: Alex | last post by:
Hello, We have a database in MS SQL 2000 and I'm trying to link to it from MS Access XP. I've created a user with full access to one specific table in the MS SQL database, but Access won't write to it. I can open this table in MS Query Analyzer and log-in as the user, and I can do update, delete, and select queries just fine... but when...
5
1908
by: Don Wash | last post by:
Hi All! I do not find any relevant newsgroups to post this question so I just posted to this VB DotNet and General DotNet groups. I'm trying to create a VB.NET application that will scan newsgroups. What I like to know is if there are any different between a MS newsgroup (microsoft.public.dotnet.general) and a UseNet newsgroup...
3
9232
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works only exporting to single worksheet. but i need to export data to multiple worksheets. it is very urgent to us. so please help me in code.
18
2230
by: Rob R. Ainscough | last post by:
MS Visual Studio Ad contained in VS Magazine. Two developers in "hip" clothing diagramming out a huge flow chart on a beach. I could NOT stop laughing at the stupidity of the ad -- "Let your ideas run free"....only to be washed up by the waves when the tide comes in -- this is exactly so so so Microsoft. Re-invent the dev tools every 3-5...
4
2297
by: Bon | last post by:
Hello all Would it be possible to migrate the MS Access 2000 to MS SQL Server 2000? My application is using MS Access 2000 as database and as user interface such as forms. Now, I want to migrate the backend database from MS Access 2000 to MS SQL Server 2000. However, I want to keep the MS Access 2000 interface. Would it be possible?
3
28414
by: mehrdad | last post by:
Hi, I have a fully functional MS-Access database. May I build such an "exe" file from a MS-Access "mdb" file which one who has not MS-Access installed on his/her system can take advantage of the database? is it possible to have an standalone MS-Access application with no need to use the MS-Access environment itself ? regds, a. nasseh
33
5914
by: Uwe Range | last post by:
Hi to all! A customer of mine told me some days ago that her IT-people told her ACCESS would not be such a good idea for continuing with our project, because Access will not be continued in the future. I haven't heard of this. Does anybody know more about it? The IT-People usually prefer Oracle. If they really want to go in this direction,...
47
4485
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small company and this is a big decision for us(!) It's not just the money it's committing to an new version of Access!
2
13493
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to execute a MailMerge to create mailing labels or customized letters. A label name known to MS Word MailMerge mailing label wizard may be used or a...
36
3428
by: Alex Martelli | last post by:
So, I thought I'd tool up to let me build and test Python extensions on Windows (as well as Mac and Linux) -- I'm trying out Parallels Workstation beta on my new Macbook Pro (and so far it seems to work very well), I bought and installed a Win2000 Pro on it (since according to the grapevine it works better than XP in various kinds of virtual...
0
7635
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7600
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5459
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5176
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.