How to Connect to database in a .P

Mady

Member
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
You can either connect your ABL session to a database with a client session startup parameter or programmatically, with the connect statement.

Startup parameter
Using a startup parameter would look like:
<session command> [-db] <physical db name/path> [other parameters]

The <session command> could be a shell script, like pro/bpro/mpro/mbpro, or a client executable like _progres/prowin/prowin32.

If you are connecting self-service, then the <name/path> is an absolute or relative path, ending with the database name. If you are connecting remotely (i.e. specifying -S <port number or service name>) then <name/path> is the logical name of the database.

Programmatically
Connecting to a database at run time involves the connect statement. It is documented in the ABL Reference manual. Reading that is left as an exercise for the reader.
 

Mady

Member
I have two files --> One is order.w and other is ps_order_fill.p. There is a call to appserver in order.w to run ps_order_fill.p on the remote server. I have given ""connect value("-db pst -N tcp -H pst-aix-dev -S 7100")."" in order.p.

Getting Error number : 1006
ps_order_fill.p Data pst is not connected

followed by "appserver error in order.w call to ps_order_fill.p"
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I have two files --> One is order.w and other is ps_order_fill.p. There is a call to appserver in order.w to run ps_order_fill.p on the remote server. I have given ""connect value("-db pst -N tcp -H pst-aix-dev -S 7100").""

in order.p
order.w?

If I understand you correctly, you have two sessions: some ABL client and an App Server, where:
  • the ABL client runs order.w;
  • order.w programmatically connects to database pst;
  • order.w runs ps_order_fill.p on an App Server;
  • ps_order_fill.p tries to access data in database pst;
  • the App Server agent logs an error that it is not connect to a pst database.
So:
  • I can see where you have instructed your ABL client to connect to the database;
  • I cannot see where you have instructed your App Server to connect to the database.
So the error (1006) makes sense to me.
 

TomBascom

Curmudgeon
How is this different from last week's complaint about error 8030?
 

Mady

Member
How is this different from last week's complaint about error 8030?
Last week, I was trying to find the appserver path to put the changes there.
Now I am facing database connection issue. Below is the appserver call in ORDER.W. In ps_order_fill.p, I am accessing a table of pst database. I am planning to put connect statement in a different .P, like CONNECT.p, and I will run this .P on appserver to try connecting to the database there on appserver, like below. Will put that call to connect.p in ORDER.W.

RUN CONNECT.p on SERVER SERVER hServ TRANSACTION DISTINCT

/****ORDER.P****/
RUN ps_order_fill.p ON SERVER hServ TRANSACTION DISTINCT
(INPUT Qstring,
INPUT iRecordLimit,
OUTPUT TABLE tt_ord,
OUTPUT fiNum,
OUTPUT lMoreRecords) NO-ERROR .
 
Top