Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access database from MTs which r located on two different machi

Status
Not open for further replies.

dcomcom123

Technical User
Jul 12, 2001
2
IN
I have two dll's in MTS which has to access the database(SQl Server) which is on a different machine. This two dlls must run in the same transaction. How do i enlist the connection for this using VB, meaning i want to have the same connection for these two components.
Can u tell me how to do this and is it possible using DSN's . If so how (using VB6.0)1

Thanks
 
Hi
Well Iam Curious to know why do u want to use two different dlls.U can have all the components in a single dll.But its up to u to decide.

Ill answer your question of connecting to the SQL Server?

Create a DSN using odbcad32.exe
Use Adodb.Connection Object and connect to the database using the open Method.
U should be able to do all data base operation with the Connect Object .



To Manage Transaction?

Set the transaction property of the Component where the transaction steps start(Alternative to Begin Tran) to Requires New Transaction


Set the transaction property of the Component where the transaction steps ends(Alternative to End Tran) to Supports Transaction.

Dont forget to use the method CommitTran/RollbackTran

This should solve your problem
 
Transaction is managed by MTS.What you need to do is tell MTS your components' transaction property and donot manage transaction manually!

For me (ADO2.6),i am using a UDL file to describe the db connection infomation and each dll will use this UDL file.I canot guarantee these two dlls will use the same db connection because the db connection is managed by MTS too.It is possible for two dll to use the same DB connection as the MTS's connection pooling technology.

Regards£¡ zallen@cmmail.com
Long live of freedom!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top