how to connect to progress database using proxygen generated

Posted by Admin on 03-May-2007 07:08

I am a newbie to various progress softwares and OpenEdge platform.

I am using Progress 9.1e RDBMS. I have a basic helloworld kind of .p file for which I have .r file. I give this .r file as input to proxygen tool and generated the proxy java code. Using these proxy java code I wrote a small standalone java program like below:

import com.progress.open4gl.ConnectException;

import com.progress.open4gl.Open4GLException;

import com.progress.open4gl.SystemErrorException;

import com.progress.open4gl.StringHolder;

import sets.*;

public class GetUserProxyNonPersistent

{

public static void main(String[] args) throws java.lang.InterruptedException

{

try

{

GetUserNonPersistent getUserNonPersistent =

new GetUserNonPersistent("jdbc:jdbcprogress:T:tri2:2312:PM3","scott","tiger","");

StringHolder UserNameHolder = new StringHolder();

getUserNonPersistent.getUserName("rod", UserNameHolder);

String UserName = UserNameHolder.getStringValue();

System.out.println("User Name is"+UserName);

} catch (ConnectException e) {

e.printStackTrace();

} catch (SystemErrorException e) {

e.printStackTrace();

} catch (Open4GLException e) {

e.printStackTrace();

}

}

}

}

In the above program I am struck at this below line:

GetUserNonPersistent getUserNonPersistent = new GetUserNonPersistent("jdbc:jdbcprogress:T:tri2:2312:PM3","scott","tiger","");

I am not sure what value to pass as first argument to the GetUserNonPersistent constructor. The progress proxygen related documentation says that we

have to pass a application server url as the arguement but I am not aware of any application server concepts in progress. Is it required

to setup an application server for using the proxygen generated code or can we do without it?

Can anyone please suggest? Hope I am clear in my questions presentation otherwise please let me know.

All Replies

Posted by jtownsen on 03-May-2007 10:41

I think you might be confusing the open client and jdbc connections. Open client connects to an Application Server. Jdbc connects to a database. Connecting to a database with jdbc doesn't allow you to run .r code.

The 9.1E OpenClient is documented here: http://www.psdn.com/library/entry.jspa?externalID=1092&categoryID=286 Take a look at Chapter 5: Programming Java Clients

You should also find some examples in the %DLC%\src\samples directory.

Posted by Admin on 04-May-2007 00:36

Thank you for the prompt response.

I am very new to various Progress softwares like OpenEdge RDBMS, OpenEdge Application Server etc. Till now I have only installed OpenEdge RDBMS but not OpenEdge Application Server.

To give little background of my original requirement, there is an existing application where the client is developed using coldfusion and client connects to WebSphere application server which uses .r files (compiled version of .p files) to connect Progress database. I am also new to the .p files concept in Progress database. My understanding is they are like stored procedures in Oracle.

Now we want to get rid of coldfusion and WebSphere and directly call .r files using java. So we thought Progress ProxyGen fits our requirements where give .r files as input to ProxyGen and it will generate the proxy java files using which we can connect to Progress database. We installed ProxyGen that comes with the installation of Progress 9.1e.

Now we have the proxy java files we dont know how to use them w.r.t passing database connection parameters to the ProxyGen generated java files. Can you please guide me here. Do I have to first install Progress OpenEdge Application Server and deploy our .p or .r files on it and then use the application server settings in our ProxyGen generated java files to connect to Progress database.

Please suggest.

Posted by Admin on 04-May-2007 01:23

Till

now I have only installed OpenEdge RDBMS but not

OpenEdge Application Server.

You will need it, as well as a development environment license for compiling the p-code into r-code.

To give little background of my original requirement,

there is an existing application where the client is

developed using coldfusion and client connects to

WebSphere application server which uses .r files

(compiled version of .p files) to connect Progress

database.

That's not possible: Java can't consume the r-code directly. Isn't there a Progress WebSpeed in the middle somehere, which is hosted in a web server? So WebSpeed is accessed by the web server and WebSpeed runs the r-code. There is a WebSpeed plugin for apache (CGI) and IIS.

I am also new to the .p files concept in

Progress database. My understanding is they are like

stored procedures in Oracle.

No they are not. You need a Progress runtime to execute the r-code. You need a runtime with a development license to compile the p-code into r-code. A runtime can be one of the following:

- a full client, which is able to run a full application with GUI, database connections, etc

- an AppServer environment, which runs sessions and can be connected remotely via the above client and Java/.Net clients. The latter requires ProxyGen generated native Java/.Net code, since it creates the wrappers for accessing the r-code on the AppServer.

- a WebSpeed environment for web development. In this case r-code produces HTML and the web server accesses WebSpeed via a plugin.

Now we want to get rid of coldfusion and WebSphere

and directly call .r files using java. So we thought

Progress ProxyGen fits our requirements where give .r

files as input to ProxyGen and it will generate the

proxy java files using which we can connect to

Progress database. We installed ProxyGen that comes

with the installation of Progress 9.1e.

You will need to install more. Take a look at the AppServer documentation and the Java open client docs. You also don't use JDBC in the p-code, but plain 4GL. The AppServer can be configured to use the right Progress database. You can do that with the ProgressExplorer administration tool. A .p code uses things like "FIND customer NO-LOCK" to do it's database access. There is no need to CONNECT to a database, since the AppServer can do that for you.

Good luck with reading up

Posted by jtownsen on 04-May-2007 03:01

I'm not sure how WebSphere was previously able to call .r's. It would be interesting to know, but not essential to solve your current issue.

A progress .r is a compiled version of the source code (.p / .w). It's similar to Java where a .java file is the source code and the .class file is the compiled version.

Progress .r's are not stored procedures. They are not loaded into the database and they are not callable from a jdbc connection to a database.

You're on the right track to solving your problem. You need to install the OpenEdge Application Server and deploy the program you're trying to run into the AppServer Broker's propath. You will probably want to make sure your AppServer connects to the required database when it starts up, but it is also possible to do this within the ABL program.

The connection from the Java client will then be made to the Application Server. (see earlier post for local of samples)

HTH

Posted by Admin on 04-May-2007 03:20

Thank you again for such detailed explanations.

So if I understand you correctly what you are saying is to use the ProxyGen generated code to connect to the database I "must" install and use the Progress OpenEdge Application Server. Am I right?

If I have to do below:

a. write a basic (helloworld kind of) .p file that just queries a Progress database table,

b. compile it into .r file,

c. deploy and run it on may be Progress Application Server or Progress IDE like Progress OpenEdge Architect

d. run ProxyGen on the .r code

e. use the ProxyGen generated code and connect to the database using AppServer and execute the code in .p file and query the Progress

database

Then what all softwares I have to install and can you pl. detail down the steps required for achieving above.

With each of your responses I am getting comfortable with Progress Software platform. Thank you once again.

Posted by Admin on 04-May-2007 05:27

So if I understand you correctly what you are saying

is to use the ProxyGen generated code to connect to

the database I "must" install and use the Progress

OpenEdge Application Server. Am I right?

That's correct. So if you want to access 4GL logic in Java, you deploy the .p to the AppServer. You can test the .p with a plain 4GL client, since you can connect to an AppServer in this environment as well. If it works OK, than you ProxyGen the .r-file to Java. Now you're able to use the generated Java binaries in your application. In the Progress installation directory there is a Java-sample somewhere. The trick is setting up the AppServer, since you have to know there is a NameServer, the AppServer and the Database server.

A hello world example would be the exchange of an integer. Create a simple .p like this:

DEFINE OUTPUT PARAMETER pSomething AS INTEGER NO-UNDO.

ASSIGN pSomething = 23.

Save these two lines as a "helloworld.p", compile it. Copy the .r-file to the AppServer. Now you can create another .p to test "helloworld.p" by calling the AppServer. From the top of my head you will have to create an AppServer connection object and call:

DEFINE VARIABLE iResult AS INTEGER NO-UNDO.

DEFINE VARIABLE hAppServer AS HANDLE NO-UNDO.

CREATE .... hAppServer ....

RUN helloworld.p ( OUTPUT iResult ) ON SERVER hAppServer.

MESSAGE iResult VIEW-AS ALERT-BOX.

Please check the 4GL reference guide for the right syntax. You can right the same procedure without an AppServer to see how it should work:

DEFINE VARIABLE iResult AS INTEGER NO-UNDO.

RUN helloworld.p ( OUTPUT iResult ).

MESSAGE iResult VIEW-AS ALERT-BOX.

You will see the difference: it's just the AppServer handle missing. Once this works you can do database access and exchange temp-tables. I'm not sure how this is supported in ProxyGen for Java, but there is probably a support Java library you should include in your program to deal with temp-tables in your Java application. A Temp-Table is not a SQL temp-table, it's a disconnected resultset.

If I have to do below:

a. write a basic (helloworld kind of) .p file that

just queries a Progress database table,

b. compile it into .r file,

c. deploy and run it on may be Progress Application

Server or Progress IDE like Progress OpenEdge

Architect

d. run ProxyGen on the .r code

e. use the ProxyGen generated code and connect to the

database using AppServer and execute the code in .p

file and query the Progress

database

Step e: use the Java generated code by ProxyGen to connect to the AppServer and execute the .r remotely. The .r can do anything to the database. You will have to design how you deal with the result set (output parameters).

Then what all softwares I have to install and can you

pl. detail down the steps required for achieving

above.

I think the AppServer documentation is a pretty good starting point for this. You can find all 4GL documentation it via the "support" link at the top of this page.

With each of your responses I am getting comfortable

with Progress Software platform. Thank you once again.

No problem, I hope you have enough pointers to get started. Download the docs from this link To get the material, jump directly to http://www.psdn.com/library/entry.jspa?externalID=2462&categoryID=230

for a good overview. Forget about AutoEdge and the architecture, focus on setting up the AppServer.

Posted by Admin on 04-May-2007 05:27

Jamie,

Thank you for the response. I have installed OpenEdge 10 Application Server and OpenEdge 10 RDBMS in the same directory C:\Progress\OpenEdge and I dont find any directory like src\samples? What is %DLC% ?

Posted by Admin on 04-May-2007 05:31

%DLC% is a very important environment variable for Progress: it tells the runtime where it's installed. This will normally be set when you start a batch file from %DLC%\bin. It points to the directory where you installed Progress. Another important one is %PROPATH% or PROPATH in a .p session. It tells the runtime where to find .p and .r objects,

Posted by Admin on 04-May-2007 05:35

I think you have to check "install samples" or something similar to get the samples installed. There is an AppServer sample in %DLC%\src\samples\open4gl\applet. In %DLC%\java you will find the Java support classes required for accessing the AppServer via ProxyGen.

Posted by Admin on 04-May-2007 06:25

Theo Albers,

Your support is great.

I installed trail version of OpenEdge 10 RDBMS, OpenEdge 10 Architect in the same directory i.e. C:\Progress\OpenEdge. However after the installation I dont find the environment variables %DLC% and %PROPATH% set in my machine? Am I missing anything?

Posted by Admin on 04-May-2007 06:27

It seems I need a webserver like IIS, Apache HTTP Server etc. before I install Progress OpenEdge Application Server. Can I use Apache HTTP Server instead of IIS for the installation of rogress OpenEdge Application Server

Posted by kevin_saunders on 04-May-2007 06:44

%DLC% is set in the progress.ini file or in the Windows registry and the same goes for PROPATH. If you use the command line tools (proenv) then %DLC% is set for you at the start.

Apache is definitely a viable option, but web servers are NOT required for the OpenClient tools or access, only for WebSpeed (used to be a separate product, but is not bundled with the Application Server). Unless you are going to be using Web applications, simply use a 'dummy' directory for the install.

Posted by jtownsen on 04-May-2007 09:31

WebSpeed (used to be a separate product, but is not bundled with the Application Server)

I'm guessing this is just a typo. WebSpeed used to be a separate product, but is now bundled with the Application Server.

Posted by kevin_saunders on 04-May-2007 09:38

Doh!! Yeah, that was supposed to be now.. Thanks Jamie..

Posted by Thomas Mercer-Hursh on 04-May-2007 11:11

A runtime can be one of the following:

You left out a self-service client from the database license.

Posted by Admin on 07-May-2007 00:03

Jamie Townsend, Theo Albers, Kevin, Thomas,

Thank you all for your support. I shall get back to you if I have anymore doubts while I progress.

This thread is closed