Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I connect an SQL database to Lotus Domino Designer?

I am creating a Lotus Notes application which has to have dynamic combo boxes. The choices for the combo boxes need to be retrieved by selecting from a SQL database.

I am new to Lotus Notes / Domino, I would love to know how to connect my SQL database for use in the domino designer. Thanks.

Edit: this is the client, not the web

Sub  Initialize

    On Error GoTo e
    Dim pw As String,user As String,odbc As String
    Dim i As Integer
    Dim conn As ODBCConnection,query As ODBCQuery,rs As ODBCResultSet
    Dim db As NotesDatabase
    Dim session As NotesSession
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim newDoc As NotesDocument
    Set session = New NotesSession  
    Set db = session.CurrentDatabase
    Set view = db.GetView("Reports")
    Set doc = view.GetFirstDocument 
    Set conn = New ODBCConnection
    Set query = New ODBCQuery
    Set rs = New ODBCResultSet
    Set query.Connection = conn 
    Set rs.Query = query

    odbc =  "server"  
    user =  "user" 
    pw =  "pass"
    Call conn.ConnectTo( odbc , user , pw ) 
        i = 0
        query.SQL =  "SELECT * FROM table" 
        rs.Execute 
        rs.FirstRow
        Do  While  Not rs.IsEndOfData
            i = i + 1
            rs.NextRow
        Loop
    conn.Disconnect
    Exit  Sub 
e : 
    MessageBox "Error " & Err & " line " & Erl & ": " & _
    Error        
    Exit Sub

End  Sub
like image 938
PRNDL Dev Avatar asked Dec 16 '22 04:12

PRNDL Dev


1 Answers

The questions is tagged Lotusscript so I assume that this is Lotusscript related (and not XPages related).

Have a look at the ODBCConnection, ODBCQuery, and ODBCResultSet Lotusscript classes in the Domino Designer Help database.

like image 94
Per Henrik Lausten Avatar answered Mar 23 '23 11:03

Per Henrik Lausten