Treat it just like any other data source. If you have OLEDB drivers for
DB2, use them. If you only have ODBC, use them. IBM's Client Access [even
Express] comes with both, and you can choose to just install the drivers on
your IIS server without installing the full CA application. One of the only
things I know to watch out for is to never end your queries with a ;. And
just think LIBRARY=database, FILE=table. Here is sample code using IBM's
OLEDB drivers:
Function ReturnCIFArray(BankNumber, JulianDate)
sDB2String = "Provider=IBMDA400.DataSource.1;Persist Security
Info=False;User ID=AnAS400UserID;Password=ValidPassword;Data
Source=HOST_NAME_OR_AS_400_IP_ADDRESS;Catalog Library
List=LIBRARY1,LIBRARY2,LIBRARY3"
sDB2SQL = sDB2SQL & "SELECT LIBRARY1.FILE1.MEMBER1 FROM LIBRARY1.FILE1
WHERE LIBRARY1.FILE1.MEMBER2='some value'"
Set oDB2ADO = Server.CreateObject("ADODB.Connection")
oDB2ADO.Open sDB2String
Set SomeRecordset = oDB2ADO.Execute(sDB2SQL)
If Not SomeRecordSet.EOF Then TheResults = SomeRecordSet.GetRows()
SomeRecordSet.Close : Set SomeRecordSet = Nothing
oDB2ADO.Close
Set oDB2ADO = Nothing
Fully qualifying the files isn't necessary if you're only looking in one
library, but for illustration purposes, I qualified them and included a
library list in the connection string.
Ray at work
"Jack" <ta*****@inextenso.qc.ca> wrote in message
news:lq****************@read1.cgocable.net...
Hi,
Using VbScript in an ASP page, I want to access a database stored on the
AS/400. Should I use ADO, ODBC or anyother way of doing it?
And is it possible to have some sample codes?
Thanks
Jack