EAS 5.2 Learning

xiaoxiao2021-03-06  18

Configure

EAS5.2 PB9.0 MS SQL2000

1. First start JAGUAR Server after installing EAS. If you are not successful, right click on "My Computer" -> Management -> Service

Set the "Jaguar" service inside to manually start.

2. Open Jaguar Manager, select Menu Tools / Connect ... New connection

3. Newly built an ODBC data source requires the next step after the test connection is successful.

4. Newly built a data cache requires the next step in the test connection.

5. Select Tools-> Easerver Profile in PB 9.0, build a Easerver connection in PB, you need to test the next step.

Server-side development steps

1. New Application "EaserverComponent" Selects "Package" in the wizard to select the Package already existing on the Easerver server, or directly enter the Package that does not exist, the wizard will automatically create this package.

The role of Package is to store the published components in order to rearward client call components.

After completing the creation, an application class, a project object, an unconviewed class will appear in one application.

Note that unconviews is the key to server-side development. Unconviews can also be created manually. Methods as below:

Built a new Custom Class class in this app, then add Activate and deActivate two times in an event.

Manually created engineering objects need to be edited

Open the engineering object, select "Properties" in the upper left corner (or menu edit / property)

Enter package in the Package Name in the Package box of the GeneAl tab in the pop-up session, which can be existing or not, if there is no free to create.

Write the computer name in the Host Name of the Easerver Host box in the Easerver Host tag, Port Number write port number, the default is 9000

Login ID in the login box writes jagadmin (or username, default jagadmin)

Login Password write password

And select the "Save Login Informion In Project" checkbox

Select the displayed PBL check box in "Checjed Libraries Will Be Consolidated" in the Libraries tab

This tag is the file that is the venamed PBR with the PBL in the bottom "PowerBuilder Resource File". This file is not existing, but it will be created automatically. Note that if the server is processed into DW, then the most Good PBR plus.

Select "Standard Component" in "CPMPONENT TYPE" below in the Components tab

Transaction Support in the Standard Options box Select "Requites Transaction"

Then click "Select Objects" in the upper left corner (or menu edit / select objects)

In the "libraries" box under the General tab, select the PBL in the "Objects" in "Objects" later, select Unconventional, click "OK".

2. Now, after the application is built, since we created the wizard, the project object is not used in modification. If it is hand-created, the engineering object and the unconviewed class, then this project object must be modified. Otherwise, the component method cannot be subject to the client

Calling, if you can't process the client submit, this unconviewed class can do transaction processing, you need to write code!

First, you must define a connection in an unconviewful instance variables.

protected:

TransactionServer ITR_JAGUAR

Note that must be a protected type, no measurement, error occurs

Next, you will write the code that creates a JAGUAR transaction object and connecting the database in an unacceptable Activate event.

code show as below

Integer Li_Result

LI_RESULT = this.getContextService ("TransactionsRVER", ITR_Jaguar) // Create a transaction object

IF Li_Result <> 1 THEN

MessageBox ("System Tips", "Creating a JAGUAR Transaction Object Failed.")

Return -1

END IF

//Connect to the database

Sqlca.dbms = "ODBC"

Sqlca.database = "db_suit"

Sqlca.dbparm = "ConnectString = 'DSN = Datasource_suit; UID = SA; PWD =', useContextObject = 'yes', cachename = 'conn_for_suit_cache'"

CONNECT Using SQLCA;

IF SQLCA.SQLCODE <> 0 THEN

MessageBox ("System Tips", "Connection Database Fails.")

Return -1

END IF

In order to save resources, it is necessary to release the connection after using the end of the event, such as release database connection code in the Deactivate event.

Disconnect Using Sqlca;

By this step, unconviewful transaction objects are no longer a problem. However, it is also necessary to be able to handle transactions. This requires adding functions in an unconviewed class, and a transaction can be used in combination with a function!

If you involve DW, you will need this DW to pass the data to the client on the server side. Then you need to set a DS, the DS definition statement is placed in an unconviewed Instance Variables.

Code

Datastore DS_MONTH_SALY

Creating a DS statement can be placed in the activate.

code show as below

IF not isvalid (IDS_MONTH_SALARY) THEN

DS_MONTH_SALARY = CREATE DATASTORE

END IF

DS_MONTH_SALARY.DataObject = "D_MONTH_SALARY"

DS_MONTH_SALARY.SETTRANSOBJECT (SQLCA)

The code to extract data and transfer to the client is written in a function, which is also a transaction!

Define a pass parameter in a function, you need to pay attention to the passable "pass" does not need to be refrene, or will not be successful.

Parameter type is blob, used to extract BLOB type data

code show as below

Long Ll_Result

DS_BM.Retrieve ()

LL_RESULT = IDS_BM.GETFULLSTATE (abline_data)

Return LL_RESULT

After you are finished, you need Build and Deploy transaction components.

Select the application where the component is located, right click to select Full Build, then Deploy

In this way, the components are onto the JAGUAR CTS server. Viewing the Package defined when you create an application on the Jaguar CTS, you can see the components just released in this package Note: Every change in the component needs to be re-released before being used by the client. Otherwise it is invalid!

Calling process steps for SQL Server in the unconviewed class of the server

The first is to create a new unspective u_proecedure_trans

The following statement is defined in the Local External functions of U_Proecedure_Trans.

Function Integer Backup_Product_ls (DateTime CopyDate, String Copyman) RPCFUNC ALIAS for "dbo.Backup_Product_ls"

Stored procedure for proxy SQL

Next, open the application class object computer_salary_server in the PBL containing u_proecedure_trans and n_computer_salary_server components

In the General tab in the General tab at the General tab of the properties of Computer_Salary_server, click the "Additional Properties" button to select the "Variable Types" tab in the pop-up, and modify the "SQLCA" property is "u_procedure_trans"

This allows you to use the stored procedure in an unconviewful component.

Using the following statement in the n_computer_salary_server component can call the SQL stored procedure, the code is as follows

INT Li_Result

LI_RESULT = SQLCA.BACKUP_PRODUCT_LS (ADT_COPYDATE, AS_COPYMAN)

Note: Since the return value of the Backup_Product_ls stored procedure is only one, use Integer in the previous U_PROECEDURE_TRANS.

If you need to return multiple values ​​during the stored procedure, this time is not applicable!

##################################################################################

EAS client development steps

1. Define a global variable for connection

Connection in_connect

If you are using the connection created using the wizard, you need to change the name of the connection class to the wizard to define the connection.

Think of generating n_client_sui_connect, then the above statement must become

n_client_sui_connect in_connect

The advantage of n_client_sui_connect with a guide is that there is no need to use the code inside the script to connect to JAGUARCTS directly.

The code is written in the OPEN event as follows

IN_CONNECT = CREATE N_CLIENT_SUI_CONNECT

If you use the first method, we have to use the script to implement the connection.

The code is as follows (written in the Open event)

LC_CONNECT = CREATE Connection // Create a connection object lc_connect.application = 'PB_EAS_SERVER_COMP' // package name, may not write, specific to the LC_CONNECT.DRIVER = 'jaguar' // Connect the object object, for Easerver, value JAGUAR

LC_Connect.Userid = 'jagadmin' // Login account, here is administrator

LC_Connect.Password = '' // jaguarts server password

LC_Connect.Location = 'Iiop: // Hostname (IP): 9000' // Corresponding Server Server1 9000 Port

LC_Connect.ConnectTOSERVER ()

The next step is to develop the operation interface of the client ~ generally window ~

2. Create a Window, add a control, and save it after the layout is complete. Create a proxy class

New "Easerver Proxy"

Select "Properties" in the upper left corner (or menu Edit / Properties)

Geneal / Deployment PBL in the pop-up session or inputs the PBL that requires the agent, here is the client. Generally, the client is needed.

Write the computer name in the host name of the Easerver Host box in the EaserVer Host, the port number write port number, the default is 9000

Login ID in the login box writes jagadmin (or username, default jagadmin)

Login Password write password

And select the "Save Login Informion In Project" checkbox

Then click "Select Objects" in the upper left corner (or menu edit / select objects)

Find in front of the pop-up session Package released to jaguarcts in front, and select the check box, the representative needs to proxy this component.

Finally, click "Deploy" in the upper left corner. After that, we can call the component method in the Window, otherwise it will prompt the error that does not exist without the compilation.

2. In Window, you should first define a proxy variable in Instance Variables, publish the component name on Jaguarcts to define a new connection agent with the previous server side.

Define local proxy connection variables

n_customer_server in_server_suit_customer_proxy

n_customer_server is a component that is sent to the EAS JAGUAR server

3. Open () Write to create a component method

as follows:

// Create a component agent

Integer Li_Result

LI_RESULT = IN_CONNECT.CREATEINSTANCE (in_server_suit_customer_proxy, "zc_customer_server_package / n_customer_server")

IF li_result <> 0 THEN

MessageBox ("System Warning", "Create Components Agent Failed.")

Close (this)

Return -1

Else

Return 1

Endiff If you use multiple server, it is a server that implements a transaction, then you must add the code to connect the Jaguarcts server in the corresponding Window Open event, no measure to turn on multiple windows to turn on, The process of use can cause the jaguarcts server to fail!

4. All transaction processing, all components are completed, generally call component methods to implement transaction processing

Integer Li_Result

Li_RESUT = IN_SERVER_SUIT_CUSTOMER_PROXY.OF_INSERT_CUSTOMER (LS_CUSTOMER_ID, LS_CUSTOMER_NAME, LS_COUNTRY, LS_PROVINCE, LS_CITY, LS_ADDRESS, LS_CONTACT_MAN, LS_TEL, LS_FAX)

IF li_result = -1 Then

MessageBox ("System Warning", "Inserting the Customer Master Information Failed.")

Return

END IF

Note that if the agent selection is incorrect, or create a component agent package selection is incorrect, it will be wrong

If the agent is incorrect, the function is compiled, and the prompt does not have this function ~

###################################################################################

Commissioning and deployment

Since the server is not allowed to make the component's debugging, only the server-side code error can be seen after the client is running after the release is released. Such efficiency is low.

You can now use Live Editing to easily debugging

When you use the Wizard to create a component, you can choose Supports Live Editing to support live editing. If it is a component already built, you can support the on-site editing function by manual.

1. Open the server-side engineering object, and select "Properties" in the upper left corner (or menu edit / property)

Select the "Advanced" tab in the pop-up session, join in "Path to Libraries from Easerver Server for Live Editing"

The PBL path is in the component. If the server and the client are not on a machine, the path is written as follows.

// servername / sharename / path / file

E.g

//mamachine/Work/pbls/xxxxx.pbl

Also, the correspondence record of the ServerName and IP addresses are added to the Host file.

2. Enter the project object name in "Easerver Project" in the "Easerver Project" in the component's General Properties page. Or click on the right button to select

Now this component supports the on-site editing.

The file generated in the hard disk after the jaguar component is released

Store below / program files / sybase / easerver / repository / directory

/ Package / component / idl three directory

/ Component

Contains a folder with published package, contains a folder with the same name as the component in this folder and one and components.

The .props file, this .props file is the properties file of the component.

And the files of the components contain CI (i = 1, 2, 3, 4 ...), release several components, there will be several folders, which is stored in the CI folder is compiled by the component. PBD file. Here is the latest, the greater the value, indicating that the PBD is the latest. The rest can be deleted.

The contents of the .props file is all the attribute lines starting with com.sybase.jaguar.component

The number of CI's folder is the com.sybase.jaguar.component.pb.jaguar.component.pb.jaguar.component.pb.cookie = X in the Props file, there are several CI directories,

It is a few times that the component is released ~

/ Idl

Contains a folder named by Package, this folder has a .idl file, the code of this file is the component function.

E.g

#ifndef __zc_suit_server_n_suit_server__

#define __zc_suit_server_n_suit_server__

#include

Module ZC_Suit_Server

{

/ **

***! - CRC 1110792762031 ->

** /

Interface n_suit_server // component name

{

String of_select_kl // Function Name

(

INOUT STRING AS_CZYID / / Function Parameters

)

Raises (:: cts :: pbuserexception);

}

}

#ENDIF

/ Package

Very simple folder, this folder contains .props files. The file life and published components are the same name.

However, the component properties are less

E.g

#Sybase EaserVer 5.0 Properties

com.sybase.jaguar.description =

com.sybase.jaguar.package.files =

com.sybase.jaguar.package.name = zc_suit_server

com.sybase.jaguar.package.roles =

Deploy Jaguar component

You need to set the jaguar jagadmin password, if the development of the components are also used as jagadmin, then the port names must be the same.

If the developed component uses a data cache, a data cache must also be established on the implementation of the object machine.

As mentioned earlier, the file location stored after the Jaguar component is released, the easiest way to deploy the JAGUAR component is / package / component / id1

Folders can be copied to the actual AGUAR installation directory.

Also a comparative formal method. as follows

1. Enter the Development Environment JAGUAR Manager console, expand Servers / Jaguar / Installed Packages

Right click on one of the releaseless packages, select "Export" in the shortcut menu that pops up -> "easerver jar"

Select "Export as Easerver Package Jar File" in the pop-up session and in Specify The Jar File Path

Enter the exported folder below, if the folder does not exist automatically

Take the JAGUAR machine implemented by JAR files

2. In the implementation environment, open the Jaguar Manager console, right click on the Packages (note, not the installedPackages under Jaguar)

Select "Deploy" in the shortcut menu that pops up -> "easerver jar" will pop up a session "Specify Jar File"

Select "Deploy from Easer Package Jar File" in this session and enter the path to the JAR file in the development environment Export, or in JAR File

Select in the button on the right. Click OK3. In the implementation environment, expand Servers / Jaguar / Installed Packages, right-click Installed Packages,

Select "Install Package ..." and select "Install An EXISTING PACKAGE" after pop-up the session.

In "Choose Package To Install", choose Components that just develop environments, click OK

The client deployment is simple, like the C / S mode. The only thing difference is to change the IP address of the connection function.

If you use the machine name to connect the JAGUARCTS server, you have to add the correspondence between the machine name and IP address in the Host file!

转载请注明原文地址:https://www.9cbs.com/read-44531.html

New Post(0)