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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with 2 databases 1

Status
Not open for further replies.

anneoctaaf

Programmer
Joined
Dec 15, 2003
Messages
104
Location
NL
my app works with odbc and an access database. Now there's another access database from with i need data to insert in my own database. How can i do this, do i need to change my ini file which contains the DNS and do i need a second transaction object? Does anyone have sample code that does what i need?

Thanx!
 
Well i thought i try something...

I added a connection object to my pbl: n_database_connectservice

*************************************************
// Set up new connection for the second database
lnv_connectserv_database = Create using "n_database_connectservice"

If lnv_connectserv_database.of_ConnectDB ( ) = 0 Then
OpenSheet (w_synchroniseren, parentwindow, 1, cascaded!)
End if
Destroy lnv_connectserv_database

*************************************************

But (ofcourse) i get the message that connection already open
My first database does already have a connection, but needs to have it, since i need to synchronise the databases.

How can i set op two connections??

ThanX!
 
You were on the right track... you need a second transaction object.
 
Code:
Example
The following statements use the default Transaction object (SQLCA) to communicate with a Adaptive Server Anywhere database and a nondefault Transaction object named ASETrans to communicate with an Adaptive Server Enterprise database:


// Set the default Transaction object properties.
SQLCA.DBMS = "ODBC"
SQLCA.DBParm = "ConnectString='DSN=Sample'"
// Connect to the Adaptive Server Anywhere database.
CONNECT USING SQLCA;
// Declare the ASE Transaction object.
transaction ASETrans
// Create the ASE Transaction object.
ASETrans = CREATE TRANSACTION
// Set the ASE Transaction object properties.
ASETrans.DBMS = "Sybase"
ASETrans.Database = "Personnel"
ASETrans.LogID = "JPL"
ASETrans.LogPass = "JPLPASS"
ASETrans.ServerName = "SERVER2"

// Connect to the ASE database.
CONNECT USING ASETrans;
// Insert a row into the Adaptive Server Anywhere 
// database.
INSERT INTO CUSTOMER
VALUES ( 'CUST789', 'BOSTON' )
USING SQLCA;
// Insert a row into the ASE database.
INSERT INTO EMPLOYEE
VALUES ( "Peter Smith", "New York" )
USING ASETrans;

// Disconnect from the Adaptive Server Anywhere
// database.
DISCONNECT USING SQLCA;
// Disconnect from the ASE database.
DISCONNECT USING ASETrans;
// Destroy the ASE Transaction object.
DESTROY ASETrans

----------
gruss aus Deutschland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top