473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 TransactionOption.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.EnterpriseServices;
using System.Runtime.InteropServices;

using IBM.Data.DB2;

namespace Db2ComPlusComponent
{
[ Transaction( TransactionOption.Required ) ]
[ ClassInterface( ClassInterfaceType.None ) ]
[ Guid( "3CBFC57F-9035-4851-8E47-CC26E13D9F53" ) ]
public class DB2Tester : ServicedComponent, IDB2Tester
{
private string _connectionString =
"server=THE-SERVER:50000;database=SAMPLE;user
Id=db2admin;pwd=thepassword";

public DB2Tester()
{
}

public int ProcessResultSet()
{
DB2Connection conn = new DB2Connection(
_connectionString );
DB2Command cmd = new DB2Command(
"Select * from administrator.employee" );

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.NewLine, e.Message );
}
finally
{
conn.Dispose();
}

return rowCount;
}
}
}

Thanks in advance,
Christian Maslen

Nov 12 '05 #1
7 2911
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.googlegr oups.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 TransactionOption.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.EnterpriseServices;
using System.Runtime.InteropServices;

using IBM.Data.DB2;

namespace Db2ComPlusComponent
{
[ Transaction( TransactionOption.Required ) ]
[ ClassInterface( ClassInterfaceType.None ) ]
[ Guid( "3CBFC57F-9035-4851-8E47-CC26E13D9F53" ) ]
public class DB2Tester : ServicedComponent, IDB2Tester
{
private string _connectionString =
"server=THE-SERVER:50000;database=SAMPLE;user
Id=db2admin;pwd=thepassword";

public DB2Tester()
{
}

public int ProcessResultSet()
{
DB2Connection conn = new DB2Connection(
_connectionString );
DB2Command cmd = new DB2Command(
"Select * from administrator.employee" );

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.NewLine, 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="1ST_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.googlegr oups.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="1ST_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.googlegr oups.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:

_ConnnectionString = "server=THE-SERVER:50000;datab*ase=SAMPLE;user
Id=db2admin;pwd=thepassword";

use:
_ConnnectionString =
"datab*ase=SAMPLE;userId=db2admin;pwd=thepassword" ;

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.googlegr oups.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:

_ConnnectionString = "server=THE-SERVER:50000;datab*ase=SAMPLE;user
Id=db2admin;pwd=thepassword";

use:
_ConnnectionString =
"datab*ase=SAMPLE;userId=db2admin;pwd=thepassword" ;

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
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...
5
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...
3
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...
18
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...
4
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...
3
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...
33
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...
47
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...
2
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...
36
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.