Tuesday, May 17, 2011

How to connect to MYSQL in Lotus Notes AGENT in Windows XP

1. Install the MYSQL
2. Install the Mysql-ODBC Driver.
3. Go to Control Panel -> Administrative Tools > Data Sources ODBC
4. Go to System DSN tab
5.    Click Add button and select the  Mysql OBDC 5.1 Driver
6.    Supply the information and click OK

7.    This will add employee variable in the list
8.    In the Desktop, add Text Document

9.    Rename the file to test2.udl or any name with the extension of udl.
10.    Click or open the test2.udl
11.    Choose the Provider tab and select Microsoft OLE DB Provider for ODBC Drivers

12.    In the Connection tab, Use the employee as data source name. And click OK

13.    Open the test2.udl in Notepad and will show the following code:
Provider=MSDASQL.1;Persist Security Info=False;Data Source=employee
14.    Create and agent and copy and paste the code below

Option Public

Option Declare

Sub Initialize

      Dim con As Variant

      Dim rs As Variant

      Dim com As Variant


      Set con = CreateObject("ADODB.Connection") ' Database connection

      Set rs = CreateObject("ADODB.Recordset") ' Handles the record set

      Set com = CreateObject("ADODB.Command") ' the query or command

      'From the test2.udl opened in the notepad

      con.open = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=employeeDB"


      Set com.ActiveCOnnection = con

       'Must have already created table in the employeeDB database

      com.CommandText = {Select * from name}


      Set rs = com.Execute



      While Not rs.EOF

            MsgBox rs.Fields("name").Value

                        'Call doc.save(True,False)






End Sub

For more information about ADO connection visit W3school

15. Run the agent to test.


  1. Thank you for the information, it helped very much. May I ask if this ADODB is an OLE-Object or what else it is?


Comments Here...

Locations of visitors to this page