Focal Point
[SOLVED] Maintain Sybase SQL passthru example needed

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7937090516

January 05, 2012, 04:25 PM
RaHansen
[SOLVED] Maintain Sybase SQL passthru example needed
Does anyone have a complete working example of a simple Sybase (15) SQL passthru for Maintain 7.7? I found the SYS_MGR.ENGINE documentation at

Maintain Language Reference

but being new to WF/Maintain I am struggling to complete working code. A version I have tried is the following:

  
...
               else begin;
                  $$ insert row into TPR_activity to record change to comment
                  Compute rc/i8;
                  Type "Inserting row into table TPR_activity ";
                  rc=sys_mgr.engine("SQLSYB","set connection_attributes SBOS509_DEV3/a_user,the_password");
                  Type "ReturnCode=<<rc DBMS Err=<<SYS_MGR.DBMS_ERRORCODE";
                  rc=sys_mgr.engine("SQLSYB","insert into dbo.TPR_activity values('ars1', ..., 'anv1');");
                  Type "ReturnCode=<<rc DBMS Err=<<SYS_MGR.DBMS_ERRORCODE";
                  $$




which gets the result:

 (FOC1400) SQLCODE IS 4 (HEX: 00000004) 
 (FOC1394) CONNECT FAILURE 
   : ct_connect(): network packet layer: internal net library error: Error st
   :  ring not available                                                     

 (FOC1414) EXECUTE IMMEDIATE ERROR. 
 (FOC1400) SQLCODE IS 4 (HEX: 00000004) 
 (FOC1394) CONNECT FAILURE 
   : ct_connect(): network packet layer: internal net library error: Error st
   :  ring not available                                                     
 (FOC1414) EXECUTE IMMEDIATE ERROR. 
 Inserting row into table TPR_activity
 ReturnCode=      -1DBMS Err=       4
 ReturnCode=      -1DBMS Err=       4



So my connect is obviously failing, but I have not been able to find much information on correct usage for Sybase connect strings for Maintain passthru.

This message has been edited. Last edited by: RaHansen,


7.7.02
Solaris
HTML/PDF
January 05, 2012, 04:33 PM
Waz
Does SQL passthrough work outside of maintain ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 06, 2012, 08:21 AM
Maintain Wizard
WAZ has a great point. See if the procedure that you are trying to run works outside of Maintain. Create a FEX, hardcode the values, and see if that runs.

What you can do is EXEC the procedure from Maintain and pass in the variables. But first get the logic to work.

Mark
January 06, 2012, 05:17 PM
RaHansen
Ok, good suggestion - I ran it from a fex successfully:

-* File sqltrans.fex
ENGINE SQLSYB SET DEFAULT_CONNECTION SBOS509_DEV3
SQL SQLSYB
insert into dbo.TPR_activity values('ars3', ..., 'anv1');


Then I tried transcribing the SET DEFAULT_CONNECTION into a sys_mgr.engine call, but got a complaint about "set default_connection" not being a valid command (are these documented anywhere?). So I removed this call, leaving just the call with the insert, and it worked. Maintain must be mapping SQLSYB to SBOS509_DEV3 automatically somehow. Thanks for the help! - Rich


7.7.02
Solaris
HTML/PDF
January 08, 2012, 04:06 PM
Waz
If it worked without the SET DEFAULT_CONNECTION setting, then its probably in the edasprof anyway.



Could you please update the first post in this thread, and add [SOLVED] in the title.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!