cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction not connected message while calling rpcfunc

Former Member
0 Kudos

I have created  a transaction userobject as given below

global type uo_customerfrom transaction end type global uo_customer uo_customer type prototypes FUNCTION long f_InsertCustomer  ( REF int al_id,REF string as_customer)  RPCFUNC ALIAS FOR 'spInsertCustomer' end prototypes type variables end variables on uo_customer.create call super::create TriggerEvent( this, "constructor" ) end on on uo_customer.destroy TriggerEvent( this, "destructor" ) call super::destroy end on

PowerBuilder script for insert record by calling function uo_customer luo_customer luo_customer= create uo_customer luo_customer.f_InsertCustomer  (li_id,ls_name)  // Here error is coming  Transaction not connected. Pls help

Accepted Solutions (1)

Accepted Solutions (1)

former_member190719
Active Contributor
0 Kudos

For the sake of those trying to read this, here's the formatted version of the code:


global type uo_customerfrom transaction

end type

global uo_customer uo_customer


type prototypes

FUNCTION long f_InsertCustomer  ( REF int al_id,REF string as_customer)  RPCFUNC ALIAS FOR 'spInsertCustomer'

end prototypes


type variables

end variables


on uo_customer.create

call super::create

TriggerEvent( this, "constructor" )

end on


on uo_customer.destroy

TriggerEvent( this, "destructor" )

call super::destroy

end on


o_customer luo_customer

luo_customer= create uo_customer

luo_customer.f_InsertCustomer  (li_id,ls_name)  // Here error is coming  Transaction not connected.


And the question would be:  Where are you actually connecting that custom transaction class to the database?


You might go into the application properties and make the class that SQLCA is created from uo_customer.  Then the code (after SQLCA is connected to the database) would look like:


SQLCA.f_insertCustomer ((li_id,ls_name) 

Otherwise, you need to connect lou_customer to the database.



Former Member
0 Kudos

How can we connect lou_customer to the database. Please can u let me know

former_member190719
Active Contributor
0 Kudos

You inherited from the transaction class.  You would do it the same way you would connect SQLCA.  Set the DBMS parm, user or login name, password, etc.  Then issue a CONNECT statement using the custom class.

lou_customer.SQLCA = ???

lou_customer.LogPass = ???

luo_customer.LogID = ???

luo_customer.ServerName = ????


CONNECT USING luo_customer

IF lou_customer.SQLCode <> 0 THEN etc, etc, etc,

Answers (1)

Answers (1)

Former Member
0 Kudos

It looks like you did not connect to the database using the transaction object you've created. You need to connect the same way as you would using SQLCA.

If you still want to use sqlca using the transaction object you've created, then you need to modify the global type declaration of sqlca in your application object. Try these steps:

1. Edit Source your application object.

2. Look for this line:  global transaction sqlca

3. Replace the 'transaction' with uo_customer, so it would look like global uo_customer sqlca

4. Save changes

5. Test again.

HTH,

Neil