Power Builder - MULTIPLES BASES

 
Vista:

MULTIPLES BASES

Publicado por yesi (25 intervenciones) el 22/08/2003 22:28:01
Hola amigos del foro, estoy haciendo una aplicacion pero necesito trabajar con dos bases de datos (leer de una y escribir en la otra), como lo hace power builder.
De antemano muchisimas gracias.
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
Imágen de perfil de Antonio
Val: 176
Bronce
Ha mantenido su posición en Power Builder (en relación al último mes)
Gráfica de Power Builder

RE:MULTIPLES BASES

Publicado por Antonio (1271 intervenciones) el 22/08/2003 23:15:59
Hola Yesi:

Mira, cuando trabajas con una sola base de datos, por default PB pone un nombre a la transaccion, p.e. SQLCA y cuando grabas datos en esta, siempre pones commit using sqlca;.. jasta ahi vamos bien, ahora bien, cuantra quieres habrir otra base de datos debes iniciar una sesion con otra transaccion p.e.

TRANSACTION nvaconexion
despues colocalas los arametros de conexion:
nvaconexion.database = BASE DE DATOS
nvaconexion.ODBC = ACCESS
etc....

cuando terminas , debes conectarte a la nueva base de datos:

CONNECT USING nvaconexion;
y yas estas conectada, ahora bien, cuando quieres grabar (debes tener un datawindow indicandole la base de datos nueva de la conexion y esta debes hacerle un conexion independiente por el painter de PB) y al grabar solo debes poner:

COMMIT USNG nvaconexion;

Y ES TODO...
SUERTE Y ESPERO TE AYUDE...

ANTONIO
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

RE:MULTIPLES BASES

Publicado por Ricardo (1957 intervenciones) el 23/08/2003 16:08:24
Otro ejemplo de la red:

CONNECTING TO MULTIPLE DATABASES
// enable transaction registration (the registration service is need when using more than one database)
gnv_app.of_SetTrRegistration(TRUE)
// register SQLCA (the connection to the first database which was connect to the usual way)
gnv_app.inv_trregistration.of_Register(SQLCA)
// connect to and register ABRN_MRS database (the second database)
// create 2nd transaction object; n_tr gtr2 must be declared global
gtr2 = CREATE n_tr
// copy connection info from the first database called SQLCA to the second database
// called gtr2 - it copies the user id, password, database name, server name, etc. from
// the definition of the first database connection to the definition of the second database connection
il_return = SQLCA.of_CopyTo(gtr2)
// re-assign the database name to the second definition
gtr2.Database = "your_2nd_database_name"
// re-assign the server name to the second definition - if it's different
gtr2.ServerName = "your_2nd_server_name"
// connect to the second database
ll_return = gtr2.of_Connect()
If ll_return <> 0 then MessageBox("Error", "Unable to connect.")
// register the second database with the registration service
gnv_app.inv_trregistration.of_Register(gtr2)
Now whenever you want to retrieve data from the 2nd database, you would write in the window's open event
li_return = dw_1.of_SetTransObject(gtr2)
dw_1.retrieve()

Suerte!
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

RE:MULTIPLES BASES

Publicado por Yesi (25 intervenciones) el 26/08/2003 23:58:13
La aplicacion la estoy haciendo usando PFC, siguiendo el ejemplo de ricardo en la aplicacion, pero solo se me levanta una base,
que puedo hacer?, gracias
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