LotusScript code to connect to AS 400 database

I am trying to connect to a DB2 database (on AS 400) and my Notes database that I am doing this from is Domino on AS 400.I have previously done this when my Notes database was on a Windows box, using ODBC DSN’s without a problem.

My code is similar to:

Set objConn = CreateObject(“ADODB.Connection”)

objConn.Open "DSN=Movex SYS;UID=EWORK;PWD=EWUSER2005"	

sql_insert = "insert into TZBBTRG (BBUSID, BBFCTN, BBFLAG, BBPRM01) values ('" & _

strUserID & "', 'LOT-1', ' ', '" & strLotNum & "')"



objConn.Execute sql_insert	



objConn.Close	

Set objConn = Nothing

What should I be changing now that my Notes database is sitting on AS 400?

Subject: example code

I do not think you need to install any extra software.

I have a 3rd part application that access data on our AS from Domino installed on the same box.

Here some code…

Option Public

Option Declare

Uselsx “*LSXODBC”

Use “Logs”

Dim session As NotesSession

Dim db As NotesDatabase

Dim curdoc As Notesdocument

Dim docpar As NotesDocument

Set docpar = db.GetProfileDocument"ProfiloGenerale")

Dim conn As New ODBCConnection

Set qry = New ODBCQuery

Set result = New ODBCResultSet

Set qrydest = New ODBCQuery

Set resultdest = New ODBCResultSet

conn. SilentMode = True

If conn.ConnectTo(docpar.ParODBCFonte(0), docpar.ParODBCUser(0), docpar.ParODBCPassword(0)) Then

	Set qry.Connection = conn

	Set qrydest.Connection = conn

	numrec = 0		

	qry.SQL = "SELECT * from " & docpar.ParODBCDataLib(0) & ".MAL0RCP where L0VLTX = ''"

	Set result.Query = qry

	Call result.Execute()

	If result.IsResultSetAvailable Then

Subject: Use LClsx

You’ll probably cannot use odbc on an AS/400.

I’m not an AS/400 guy, but I remember I used the lclsx extension to access db2 natively.

It’s now installed on your domino server if you install DECS option in domino.

The main advantage is that it should work on any platform where you have domino and DB2 without changing your lotusscript code.

When you install DECS, it should install the Lotus Connector LotusScript Extension Guide in the help directory of the server. This is the whole developper reference on how to use these connectors.

Hope this helps

Renaud