Domino 9 und frühere Versionen > Administration & Userprobleme
DB2 Daten auslesen
(1/1)
Abdelhadi Doujali:
Hallo zusammen und frohes neues,
ich möchte gerne Daten aus DB2 Mit Hilfe der LotusScript Extensions.
Connection und Zugriff auf die Tabelle funktioniert, jedoch wenn ich im Debuger
die Inhalte aller Felder, die im LCResultSet gespeichert sind,sehe, dann stelle ich fest dass alle Felder leer sind, obwohl meine DB2 Tabelle voll mit Daten ist.
Woran könnte das wohl liegen? Danke für eure Hilfe.
Hier ist mein Script:
On Error Goto ErrorHandler
Dim connectdb2 As New LCConnection ("db2")
Dim lc_session As New LCSession
Dim fields As New LCFieldList
Dim field As LCField
'***** Verbindung zur DB2-Datenbank herstellen
connectdb2.Database = "DBTEST"
connectdb2.Userid = "hallo"
connectdb2.Password = "hallo"
connectdb2.Metadata = "outtput"
connectdb2.MapByName = True
'***** Rollback-Property auf True *****
Call connectdb2.SetPropertyBoolean(2,True) '
connectdb2.Connect
If connectdb2.isconnected Then
Messagebox "Connection is successefull"
End If
Dim LCResultSet As New LCFieldList
Dim sSQL As String
Dim iCount As Integer
sSQL = "SELECT * FROM RU.CPS_CS_EPM"
iCount = Cint(connectdb2.Execute (sSQL, LCResultSet))
Msgbox ">>>>>>>>>>>>>>> RECORDS1: " & Cstr(iCount)
Exit Sub
ErrorHandler:
If (lc_session.status <> LCSUCCESS) Then
Messagebox lc_session.GetStatusText,0,"the following lotus connector error has occured"
Else
Messagebox Error$ & " at line " & Erl(), 0, "the following lotusScript error has occured"
End If
Exit Sub
:-*
Marinero Atlántico:
Weiss nicht.
diese Zeile:
--- Code: ---connectdb2.Metadata = "outtput"
--- Ende Code ---
sieht merkwürdig aus. 2 t.
Versuch doch einfach ein Skript aus den Beispielen der Hilfe und pass es auf deine Bedingungen an:
--- Code: ---Sub Initialize
Dim src As New LCConnection ("db2")
Dim fldLst As New LCFieldList
Dim fld As LCField
Dim count As Integer
' set the appropriate properties to connect
src.Database = "Gold"
src.Userid = "JDoe"
src.Password = "xyzzy"
src.Connect
' now connected, we can execute a selection statement
If (src. Execute ("SELECT * from customer", fldLst) = 0) Then
Print "No records were fetched."
End
End If
Set fld = fldLst.Lookup ("CONTACTNAME")
Print "the 'contact names' stored in the table are:"
' fetch each record from the result set
While (src.Fetch (fldLst) > 0)
count = count + 1
Print " record #" & Cstr(count) & " = '" & fld.text(0) & "'"
Wend
If (count = 0) Then Print "No records were fetched."
End Sub
--- Ende Code ---
Navigation
[0] Themen-Index
Zur normalen Ansicht wechseln