Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to an AS/400 via ASP

Status
Not open for further replies.

THEGREEK

Technical User
Aug 17, 2000
51
CA
Hi,

Firstly, IBM Client Access ODBC Driver (32-Bit) 4.00.00.01 is installed on IIS.

I've been trying to connect to the AS/400 via ASP for the longest while, but I'm still always drawing blanks when it comes to results. Is there anyone here that can help me out regarding a valid connection string to achieve what I want above?

Thanks for your help in advance,
THEGREEK
 
I've never worked with AS400, but it is my understanding that if the ODBC drivers are installed on the server, then you can just set up a DSN for the database in the control panel of the server.

Once you have that set up, then all you need to do is create and open your connection
Code:
dim con
set con = server.createobject ("ADODB.Connection")
con.open ("DSN=myAS400;UID=uid;PWD=pwd")

hope it helps! :)
Paul Prewett
 
Is there any way to make a DSN-less connection the AS/400 as you can with SQL?
 
Oh, I'm sure there is, but I'm not the one to tell you how to do it. Sorry. :-(

I would try my best to do it with a DSN if I were you, though. DSN-less connections aren't as reliable as the former (just a heuristic, not a law) --

good luck --
 
I have written a business object(DLL) which connects to the AS400 using a DSNLESS connection.

Here is the code I used in VB6.

dim rdconThis as rdo.rdoConnection

Set rdconThis = New rdoConnection

strDriver = "Client Access ODBC Driver (32-bit)"
strSystem = "AS400 Machine Name"
strLibraryName = "AS400 Library Name"
strOther = "MT=0;NAM=1;DFT=5;DSP=1;TFT=0;TSP=0;DEC=0;XDYNAMIC=0;RECBLOCK=2;BLOCKSIZE=32;SCROLLABLE=0;TRANSLATE=0;LAZYCLOSE=0;LIBVIEW=0;REMARKS=0;CONNTYPE=2;SORTTYPE=2;LANGUAGEID=ENU;SORTWEIGHT=0;"

With rdconThis

' build dsnless connection string
.Connect = "Driver=" & strDriver & ";" & _
"SYSTEM=" & strSystem & ";" & _
"UID=" & strUserId & ";" & _
"PWD=" & strPassword & ";" & _
"DBQ=" & strLibraryName & ";" & _
strOther

.CursorDriver = rdUseServer

.EstablishConnection Prompt:=rdDriverNoPrompt

End With


If you want to create dsnless connection, the best way I've found to do this is set Prompt:=rdDriverPrompt. Then, just before you establish the connection, display the contents of the connect string. Copy the contents of the connect string that was built, change Prompt:=rdDriverNoPrompt and use the connect string that was built for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top