how to connect a database in .w file?

Posted by balaji on 11-Apr-2014 03:30

?currently i am facing the issues , i am having a file new.w in that file i have browse to display the sport2000 customer table when i am connected to sports2000 database s connected the same file new.w i when i right click and opened n procedure editor and wen i run the file throws an error unknown table customer but my objective t should connect automatically to the sports database i have tried using connect statement,pf file is there any way to figure this out? thanks.

All Replies

Posted by Dileep Dasa on 11-Apr-2014 03:52

Direct manipulation of .w is not encouraged.

You can have a wrapper procedure file which connects to the database and then runs your .w file like:

connect mydb.db -1. /*Assuming database is not served*/
run new.w.
disconnect mydb.



Posted by egarcia on 11-Apr-2014 04:13

Hello,

Since you want to automatically connect to the database, the simplest approach is to specify the database connection as a startup parameter to the OpenEdge client.

Examples:

prowin32 sports2000

prowin32 sports2000 -param a.p

prowin32 -db sports2000 -p _ab.p

prowin32 -pf my_pf_file.pf -p _ab.p

These examples are for the Procedure Editor and the AppBuilder.

Do you have Progress Developer Studio installed?

If so, you can just create a database connection from the environment.

The following thread has a similar subject:

community.progress.com/.../35063.aspx

I hope this helps.

Posted by Thomas Mercer-Hursh on 11-Apr-2014 09:23

To be clear, connection to the database must be "outside" the procedure or class which accesses the database.  This can be via a startup parameter, i.e., the connection is established prior to running any actual ABL code or it can be done in ABL code, but if done in code one must go one level farther down, i.e., into a run .p or .w or into a newed class before that connection can be used.

This thread is closed