Link to home
Start Free TrialLog in
Avatar of digdug89
digdug89

asked on

ASP ODBC connection to AS400

I am having a problem with my asp page not connecting to the AS/400.  When I go to that page I.E. seems to try to connecto, but eventually does nothing.  My timeout is set to 30 seconds but it doesn't even do that.

Here is the connection code that I took from this website

<%
dim mConn
dim mRS

set mConn = server.createobject("ADODB.Connection")
mConn.Open "DSN=VACTOR400;UID=myuid;PWD=mypwd"

set mRS = server.createobject("ADODB.Recordset")
set mRS.ActiveConnection = mConn
mRS.Open "select * file"  'does this need to be library.file ??

'do while not mRS.eof
     ' enter code for building your html table
 '    mRS.movenext
'loop

mRS.close
set mRS =nothing

mConn.close
set mConn = nothing

%>
Avatar of digdug89
digdug89

ASKER

I seemed to solve the problem by using a different connection string.  This still does not resolve my problem why the above code sits in an "time out" state.  I have attached my change so anyone may view.  I will still give the points to anyone who can explain the difference and give me a correct connection string.

With mConn
.Provider = "IBMDA400"
.Properties("Data Source") = "191.6.0.1"
.Properties("User Id") = "meuid"
.Properties("Password") = "mepwd"
.Open
End With
hi...

mConn.Open "DSN=VACTOR400;UID=myuid;PWD=mypwd"
-> did you create the DSN named VACTOR400 ?

the difference i can see is on code#1, you should pre-create the DSN
on code#2 the datasource is created on the fly
Yes, I did pre-create the dsn vactor400.  That does seem to be the problem area.  However, I would like to be able to use DSN's in the future.  Sorry, if I am so "rough" at the coding, I am really an RPG400 programmer. Anyway, when I create the DSN on the fly it seems to work just peachy.  However, when I use the DSN, it seems like it is in an endless loop. I have used this code both on my test pc, and on the webserver(win2k & IIS 5.0), and both have the same problem when accessing the page with the DSN (like it's in a never-ending connecting state).  Also, anyone know where there is any type of training or books for ASP ------> AS/400. I am using Interdev and frontpage but most books out there don't deal with an AS/400 connection. Thanks for your response dedy.
One problem could possibly be the way you have configured your DSN for the security if you are using Client Access as the driver.

Not sure of the specifics but under the Connection Option under the first tab, you will see some choices for Sign On Information.

If this isn't configured correctly, it is probably trying to pop up a log on box and it cannot. This could casue your time out error.
I notice under my connection options for the system dsn  I have --use operations Navigator default-- and --use same security as operations navigator connection-- for signon and security information respectively.
ASKER CERTIFIED SOLUTION
Avatar of dedy_djajapermana
dedy_djajapermana

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One of the things to check as well is the default library that the username you are using connects to.  You may have to "strongly type" the actual file you are looking for such as:

"Select * from aplus2.WBSIOQ Where W6WUID='somevalue'"  where aplus2 is the base library.  The user account that I log in as sets the default library to something else.

The default library setting in the ODBC CAExpress doesn't seem to work right at least in 5.1.  Good luck.  I am using .NET 1.0 not ASP so there are a few differences but none that should apply here because the .NET ODBC Connector performs basically the same in 1.0 ...can't say for 1.1