2010年3月27日 星期六

oo4o OraParameter Object 補oracle help 不足 、Oracle RDBMS 使用

oo4o OraParameter Object 補oracle help 不足 、Oracle RDBMS 使用。

■バインド変数

  ・バインド変数を使用した更新を行う事ができる。
    Oracle サーバ上のキャッシュ SQL が利用できるので高速になる。

■OraParameter Object 使用

  ・Parameters.Add 新增參數。
    ServerType 設定方式。(OraParameter)

  OraDatabase.Parameters.Add "變數名稱", 0, ORAPARM_INPUT
                             變數初始值 _|        |
                             輸入 ORAPARM_INPUT  _|
                             輸出 ORAPARM_OUTPUT
                             I/O  ORAPARM_BOTH

  OraDatabase.Parameters("變數名稱").ServerType = ORATYPE_CHAR
                                      ORATYPE_VARCHAR2 _|
                                      ORATYPE_NUMBER
                                      ORATYPE_SINT
                                      ORATYPE_FLOAT
                                      ORATYPE_STRING
                                      ORATYPE_VARCHAR
                                      ORATYPE_DATE
                                      ORATYPE_UINT
                                      ORATYPE_CHAR
                                      ORATYPE_CHARZ
                                      ORATYPE_CURSOR

  ・Value 取得方式。

  OraDatabase.Parameters("變數名稱").Value = "a001"

  ・Parameters.Remove 變數移除方式。

  OraDatabase.Parameters.Remove "變數名稱"

轉載網站:http://homepage2.nifty.com/sak/w_sak3/doc/sysbrd/vb_s24.htm

2010年3月17日 星期三

Lotus Notes 連接oracle的另一種想法

想法透過 Oracle Objects for OLE 的方式進行連接Oracle 資料庫,正在測試中:
Example:
Q:
What do I need on my R5.0.12 domino server to make a connection to an Oracle 8.x server?

I would like to do this using Java or LotusScript directly to the Oracle database (No DSN).
Thanks,
-Lance

Ans:

RE: Making a connection to Oracle
Posted by Siddharth Gupta on 5.May.03 at 上午 09:17 using a Web browser
Category: Lotus ConnectorsRelease: Lotus Connectors - All ReleasesPlatform: Windows 2000


You need oracle objects for ole to do this. Basically if you have an Oracle client installed on your machine then you will have this.

You will need to instatioate the oracle sessions by a code similar to this:


 
  Set OraSession = CreateObject("OracleInProcServer.XOraSession")
'Get the OraClient object.
Set OraClient = OraSession.Client
'Create a named OraSession Object. Alternatively, you could use the CreateNamedSession method of the OraSession Object.
Set NamedOraSession = OraClient.CreateSession("Anyname")
'Create the OraDatabase Object by opening a connection to Oracle.
Set OraDatabase = NamedOraSession.OpenDatabase(DbName,Username,Password)




資料來源:Enterprise Integration Forum
/****************************************/
2010/3/18 下午測試成功,範例如下:
/***************************************/
 
Sub Postopen(Source As Notesuidocument)
    Dim OraSession As Variant
    Dim ODatabase As Variant
    Dim ODynaset As Variant
   
    Set OraSession = CreateObject("OracleInProcServer.XOraSession")
     'Get the OraClient object.
    Set OraClient = OraSession.Client
     'Create a named OraSession Object. Alternatively, you could use the CreateNamedSession method of the OraSession Object.
    Set OraSession = OraClient.CreateSession("FIAC")
     'Create the OraDatabase Object by opening a connection to Oracle.
    Set OraDatabase = OraSession.OpenDatabase("FIAC","fiac/fiac",0&)
   
    If (OraDatabase Is Nothing ) Then
        Messagebox "ORACLE Connect Error"
        Exit Sub
       
    End If
    Set ODynaset=OraDatabase.CreateDynaset("select * from figc",0&)
    Msgbox ODynaset.fields("ComLab").value
       '取得Oracle 資料
    Call source.FieldSetText("ComLab", ODynaset.fields("ComLab").value )
    ODynaset.close
    OraDatabase.close
End Sub