AS400 connection string referencing multiple libraries

What is the correct syntax for an AS400 connection string where multiple libraries can be referenced. I tried using the library list parameter, but it did not seem to work. My code needs to join two files from different libraries.

1 answer

Running on a Microsoft IIS server with IBM client Access db connector using classic ASP server side code.

Example query joining 2 different library tables (This works for us):

select
A.LGLGNM,
A.LGNMBR,
B.LGDSEC
from
LIBRARY1.TABLE1 as A
join
LIBRARY2.TABLE1 as B
on
A.LGNMBR = B.LGNMBR
where
A.LGSTAT = 'A'
and
A.LGMES1 <> ''
order by
A.LGNMBR

Passed to the following ASP code:

'IBM AS400
Private Function DB(strSQL)
Const adOpenForwardOnly = 0, adOpenStatic = 3, adUseServer = 2, adLockReadOnly = 1
Dim objRS, strConn
strConn = "Provider=IBMDA400;" & "Data Source=AS400;" & "User Id=yourAS400ID;" & "Password=yourAS400Password"
Set objRS = Server.CreateObject("ADODB.Recordset")
With objRS
.CursorType = adOpenForwardOnly
.CursorLocation = adUseServer
.LockType = adLockReadOnly
.ActiveConnection = strConn
.Source = strSQL
.Open
If .BOF then
DB = Null
Else
DB = .GetRows()
End If
.Close
End With
Set objRS = Nothing
End Function

Hope this helps. ;^)