Solved
Access SQL Server database from Lotus Notes using lsxlc
Posted on 2011-09-11
I am making a new app in Lotus Notes, it requires to access a MS SQL Server for accessing some data and past them in a Lotus Notes document.
I want to use lsxlc for this, but I can not make the logon to work, I get a 12325 error "Logon failed"
I think that the problem is in the name of the server or user name. I have tried many options but with no sucess
Something wrong here? Thanks
Uselsx "*lsxlc"
Sub Initialize
Dim s As New NotesSession
Dim uiw As New NotesUIWorkspace
Dim db As NotesDatabase
Dim LCses As LCSession
Dim LCcon As LCConnection
Dim LCfldLst As New LCFieldList
Dim uid As NotesUIDocument
Dim doc As NotesDocument
Dim newDoc As NotesDocument
On Error Goto errorHandler
Set db = s.CurrentDatabase
'get the query
Set uid = uiw.CurrentDocument
If uid.EditMode Then Call uid.Save
Set doc = uid.Document
qs$ = doc.QS(0)
If qs$ = "" Then
Messagebox "No Search Query Specified"
Exit Sub
End If
'connect to sql
Set LCses = New LCSession
Set LCcon = New LCConnection("OLEDB")
LCcon.Provider = "SQLOLEDB"
'LCcon.Auth_Integrated = "SSPI"
LCcon.Init_DataSource = "40-dbs" 'DataSource name
LCcon.Database = "dbo.personal" 'Database name
LCcon.Userid = "hector_herrera"
LCcon.Password = "********"
LCcon.Connect
If Not LCcon.IsConnected Then
Messagebox "Unable to connect to SQL."
Exit Sub
Else
MessageBox "Worked !!!"
End If
SQL_Statement = qs$
result = LCcon.Execute ( SQL_Statement, LCfldlst )
result = LCcon.Fetch ( LCfldlst, 1, 1 )