I want to pull DB2 data into a Notes Application

I have never done anything with connectors and I don’t even know where to begin with this. We’re running Notes/Domino on a Linux server and I would like to be able to pull in data from an AS400.

I’m looking for instructions on getting started, doing any set-up necessary on the Domino Admin side, etc. Any help or pointers to articles would be greatly appreciated.

Subject: I want to pull DB2 data into a Notes Application

You need to have DB2 Connector installed and configured to access the DB2 server/database. then

Option Public

Uselsx “*lsxlc”

Sub Initialize

Dim session As New NotesSession

Dim db As notesdatabase

Set db = session.currentdatabase



Dim LcConnection As New LCConnection ("db2")

LcConnection.Database = "DBNAME"

LcConnection.Userid   = "userid"

LcConnection.Password = "password"

LcConnection.Fieldnames = "XXX1, XXX2, XXX3, XXX4"

LcConnection.Connect



If LcConnection.isconnected Then

	Print "CONNECTION OK!"

Else

	Print "NOT CONNECTED!"

End If



Dim LcResultFieldList As LCFieldList

Set LcResultFieldList = New LCFieldList	



Call LcConnection.Execute({SELECT XXXXXXXXX FROM YYYYYY WHERE ZZZZZ)}, LcResultFieldList)



Dim LcField1 As LCField

Dim LcField2 As LCField

Dim LcField3 As LCField

Dim LcField4 As LCField



Set LcField1 = LcResultFieldList.Lookup("XXX1")

Set LcField2 = LcResultFieldList.Lookup("XXX2")

Set LcField3 = LcResultFieldList.Lookup("XXX3")

Set LcField4 = LcResultFieldList.Lookup("XXX4")



Dim count As Long



Dim newdoc As NotesDocument



While (LcConnection.Fetch (LcResultFieldList) > 0)

	count = count + 1

	Print count, LcField1.Text(0), LcField2.Text(0), LcField3.Text(0)

Wend 



LcConnection.Disconnect	

End Sub

Subject: RE: I want to pull DB2 data into a Notes Application

Javier - As far as I know there is no db2 connector for Linux. You need to use the Lotus branded Data Direct ODBC drivers.

Subject: RE: I want to pull DB2 data into a Notes Application

you should run the connector from another windows machine. What i wanted to show was the technique to connect.

Subject: Search Domino Designer Help for “Lotus Connectors”

Subject: RE: Search Domino Designer Help for “Lotus Connectors”

Alan, have you actually tried to use the Lotus Connectors help? I don’t mean to sound negative all the time, but it’s truly bad.

Subject: RE: Search Domino Designer Help for “Lotus Connectors”

Thanks so much for the infomation provided. It gives me a good start. I have searched, and searched and it’s all a bit overwhelming. I appreciate the help!

Subject: I want to pull DB2 data into a Notes Application

Lotus provides their own branded versions of the Data Direct ODBC drivers on Passport Advantage. Download and install them, then edit /etc/profile and add the following before the existing export line:ODBCINI=/opt/odbc32v51/odbc.ini

LD_LIBRARY_PATH=/opt/ibm/lotus/notes/latest/linux:/opt/odbc32v51

add the following after the existing export line

export ODBCINI LD_LIBRARY_PATH

Then edit /optodbc32v51/odbc.ini and dot he following:

change [DB2 Wire Protocol] to [what you want to call the database]

add # before Database= line

update IpAddress= to your DB2 server’s IP address

update Location= to DB2 database na,e (WRKRDBDIRE on the AS/400 to get the name)

update TcpPort= to 446 (default DB2 DRDA port, update as needed)

Replace odbc32v51 above with the path you install the drivers to.

Then you can use Javier’s sample code to access the database. Change the LCConnection.ConnectionType to “odbc2”, and use connection.Server = “whatever you called it in odbc.ini”

Subject: I want to pull DB2 data into a Notes Application

Here’s a sample I posted awhile back.

I’m running various ODBC agents from Notes Clients (WinXP) and from Domino running on a second AS/400 as well, but no Linux - sorry.

http://www-10.lotus.com/ldd/nd6forum.nsf/AllFlatweb/89cb4fc5cdac72998525715600110299?OpenDocument

Beisges accessing the 400, you’ll need to ensure that your ‘user’ has authority to the files on the 400 (WRKOBJAUT) - Unless you’re updating a file, you’ll usually want *USE authority.

Subject: I want to pull DB2 data into a Notes Application

http://www.redbooks.ibm.com/abstracts/sg246067.html <<<Incredible resource for LEI and LC LSX coding

Although you may not have LEI 6 it has an excellent section on LC LSX coding.