I have a DB2 table with many records which a should read and extract some data from the registers inside of this table to a NSF file.I would like to do it in LS. Is it posible?
Can anybody send me a little example of how con I make the connection to the DB2 Database and reach this data.
Any help would be appreciated
Subject: How to extract data from a DB2 table
If you have an ODBC connection you can use SQL…look into ODBCConnection, ODBCQuery, ODBCResultSet
Subject: RE: How to extract data from a DB2 table
Malinda: Please this is my code in LS. It seems to work fine but no row is returned.Could you verify it please?
…"
Dim session As New NotesSession
Dim db As NotesDatabase
Dim con As ODBCConnection
Dim dataSource As String
Dim userName As String
Dim password As String
Dim odbcQuery As New ODBCQuery
Dim odbcResultSet As New ODBCResultSet
Set con = New ODBCConnection
dataSource = string
userName = string
password = string
If Not con.ConnectTo(dataSource,userName, password) Then
Print "Could NOT connect to " & dataSource
Exit Sub
Else
Print "Could connect SUCCESFULLY to " & dataSource
End If
Set odbcQuery.Connection = con
odbcQuery.SQL = "SELECT * FROM V_PERSONAL"
Set odbcResultSet.Query = odbcQuery
status = odbcResultSet.Execute
If rows% = odbcResultSet.IsResultSetAvailable Then
Print "Has at least one row of data"
End If
con.Disconnect
"…
Subject: RE: How to extract data from a DB2 table
Juan Does this logon have the correct library list for access to V_personal?
dataSource = string
userName = string
password = string
Subject: How to extract data from a DB2 table
Do you have LEI at your disposal? If so, I’d create a DB2 Connection Document, where you can enter the username and password associated with the table you wish to access. You would also create a Scripted Activity, where you can use LS. If you DO have LEI, it could possibly be done easier with Direct Transfer, but then you have less ‘control’ over the functionality.
Subject: RE: How to extract data from a DB2 table
Daniel: Please this is my code in LS. It seems to work fine but no row is returned.Could you verify it please?
…"
Dim session As New NotesSession
Dim db As NotesDatabase
Dim con As ODBCConnection
Dim dataSource As String
Dim userName As String
Dim password As String
Dim odbcQuery As New ODBCQuery
Dim odbcResultSet As New ODBCResultSet
Set con = New ODBCConnection
dataSource = string
userName = string
password = string
If Not con.ConnectTo(dataSource,userName, password) Then
Print "Could NOT connect to " & dataSource
Exit Sub
Else
Print "Could connect SUCCESFULLY to " & dataSource
End If
Set odbcQuery.Connection = con
odbcQuery.SQL = "SELECT * FROM V_PERSONAL"
Set odbcResultSet.Query = odbcQuery
status = odbcResultSet.Execute
If rows% = odbcResultSet.IsResultSetAvailable Then
Print "Has at least one row of data"
End If
con.Disconnect
"…