Power Builder - Duda sobre BD

 
Vista:
sin imagen de perfil

Duda sobre BD

Publicado por Zoid (2 intervenciones) el 21/06/2014 17:24:39
Buen día expertos, tengo una consulta, ¿si tengo una aplicacion de Power Builder y quiero conectarme con multiples Bases de Datos, que debo hacer, por ejemplo una 20 o 50 Base de Datos ?? Salu2 :D
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Duda sobre BD

Publicado por angel garcia (54 intervenciones) el 25/06/2014 00:17:54
Hola .. lo que debes hace es crear varios objetos transaccionales como el SQLCA

You then instantiate the object:

TransactionObjectName = CREATE transactionFor example, to create a Transaction object named DBTrans, code:

transaction DBTransDBTrans = CREATE transaction// You can now assign property values to DBTrans.DBTrans.DBMS = "ODBC"...Assigning property values
When you assign values to properties of a Transaction object that you declare and create in a PowerBuilder script, you must assign the values one property at a time, like this:

// This code produces correct results.transaction ASETransASETrans = CREATE TRANSACTIONASETrans.DBMS = "SYC"ASETrans.Database = "Personnel"You cannot assign values by setting the nondefault Transaction object equal to SQLCA, like this:

// This code produces incorrect results.transaction ASETransASETrans = CREATE TRANSACTIONASETrans = SQLCA // ERROR!Specifying the Transaction object in SQL statements
When a database statement requires a Transaction object, PowerBuilder assumes the Transaction object is SQLCA unless you specify otherwise. These CONNECT statements are equivalent:

CONNECT;CONNECT USING SQLCA;However, when you use a Transaction object other than SQLCA, you must specify the Transaction object in the SQL statements in Table 12-3 with the USING TransactionObject clause.

Table 12-3: SQL statements that require USING TransactionObject COMMIT
INSERT

CONNECT
PREPARE (dynamic SQL)

DELETE
ROLLBACK

DECLARE Cursor
SELECT

DECLARE Procedure
SELECTBLOB

DISCONNECT
UPDATEBLOB

EXECUTE (dynamic SQL)
UPDATE


To specify a user-defined Transaction object in SQL statements:

Add the following clause to the end of any of the SQL statements in the preceding list:

USING TransactionObjectFor example, this statement uses a Transaction object named ASETrans to connect to the database:

CONNECT USING ASETrans; Always code the Transaction object
Although specifying the USING TransactionObject clause in SQL statements is optional when you use SQLCA and required when you define your own Transaction object, it is good practice to code it for any Transaction object, including SQLCA. This avoids confusion and ensures that you supply USING TransactionObject when it is required.

Example
The following statements use the default Transaction object (SQLCA) to communicate with a SQL 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 SQL 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 = "SYC"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 SQL Anywhere databaseINSERT INTO CUSTOMERVALUES ( 'CUST789', 'BOSTON' )USING SQLCA;// Insert a row into the ASE database.INSERT INTO EMPLOYEEVALUES ( "Peter Smith", "New York" )USING ASETrans;// Disconnect from the SQL Anywhere databaseDISCONNECT USING SQLCA;// Disconnect from the ASE database.DISCONNECT USING ASETrans;// Destroy the ASE Transaction object.DESTROY ASETrans
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar