6、 管理串連緩衝
(A) 在JaguarManager中雙擊Servers,在列表中選一個Server。
(B) 選Install Connection Caches
(C) 右鍵,在彈出的菜單上選“Create and Install a New Connection Cache”
(D) 在彈出的視窗中輸入Connection Cache名。
(E) 確定後就進入了Connection Cache配置面板。
(F) 本文以配置SQLSERVER為例。在General選項卡中配置:Server Name 為SqlServer的服務名。User Name為登入SqlServer的使用者ID,輸入PassWord。在Driver選項卡中選ODBC,DLL OR CLASS NAME 為ODBC32.DLL。PING一下試試。
(G) 若PING通不過,你就得看一下本文前面(3)提到的HostName你輸入的是什麼,若LocalHost就不行,改為你的機器名。
二、開發應用部分
A、服務端:
1、 建立EAServer Profile如下圖。Server Name即電腦名稱。Port Number為9000,Login Name為Jagadmin。
2、 在NEW----TARGET----EAServer Component開始嚮導
3、 Next-Next-應用程式名稱、庫檔案存放-Next-Implement New InterFace--PBObjectName(n_cst_base)EAServer Component Name--EAServer Profile--Pakeage Name(組件以包為單位,新增一個包或選一個存在的包)--Component Type(stadard component)--Instance Pooling Options(Supported)--Transaction Supported Option(Not Supported)--Interface Options(Next)--Other Options(全選)--Project(Next)--Next--Next--Finish
4、 開啟剛建立的組件N_cst_base,在Constructor事件中:
SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
SQLCA.Database = "Jaguar_2001"
SQLCA.ServerName = "jaguarcts"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
CONNECT USING SQLCA ;
IF SQLCA.SQLCODE = -1 THEN
messagebox(“system”,"資料庫連接失敗!"+SQLCA.SQLERRTEXT)
END IF
5、 在N_cst_base的Destructor事件中:
Disconnect Using SQLCA ;
6、 在N_cst_basek中新增一個對象函數:
of_user_login(string as_userid,string as_password) return integer
//
integer li_return
SELECT count(*) INTO :li_return FROM jag001 WHERE jag0101 = : as_userid and jag0102 = : as_password ;
RETURN li_return
Jag001表的欄位:jag0101(varchar(20))—jag0102(varchar(20))
7、 產生組件代理對象
NEW--PROJECT----EAServer Proxy Wizard一直NEXT,值得注意的是出現一個TreeView時、讓你選一個包(即在3中建立的包),下一步是選一個代理庫(可以選存在的PBL,也可以新增一個PBL),NEXT後是Deployment Actions,要選三(代理對象名=包名+組件名)
8、 若不出意外,代理對象就產生了。
B、用戶端:
1、 建立一個應用。
2、 建立一個連線物件
NEW--PBObject--Connection Object Wizard其中值得注意的是Connectivity Options(Requires EAServer Connection);Pakage Name即3中建立的包。Connection Object名可以預設,也可以自已輸入;resource of connect information可以任選一種。
3、 在新應用的open事件:
n_cst_connect inv_connect_srv //2建立的連線物件聲明
Jaguar_2001_n_cst_base inv_login_srv //代理對象聲明
integer li_return