470,594 Members | 1,427 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

ASP and AS/400

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
Jul 19 '05 #1
1 4819
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.