|
-
Oct 2nd, 2001, 08:37 AM
#1
Thread Starter
Lively Member
odbc - ADO to connect to as/400
Could someone help me (code) to connect to an as/400 database using ado and an odbc driver.
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
-
Oct 2nd, 2001, 09:49 AM
#2
-
Oct 2nd, 2001, 09:56 AM
#3
Thread Starter
Lively Member
thanks but I have looked there and I am still confused about the connection string.
any help???
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
-
Oct 2nd, 2001, 11:15 AM
#4
Lively Member
AS400 connection
Dim rsAS400 As ADODB.Recordset
Dim cnAS400 As ADODB.Connection
Set cnAS400 = New ADODB.Connection
Set rsAS400 = New ADODB.Recordset
'Live connection
cnAS400.ConnectionString = "DSN=AS400;DRIVER={client Access ODBC data source};SERVER=servername;DATABASE=libraryname;UID=userid;Passwowd=kmu;"
cnAS400.Open
Set rsAS400.ActiveConnection = cnAS400
rsAS400.LockType = adLockBatchOptimistic
rsAS400.CursorType = adOpenKeyset
In addition, you must set up a ODBC connection. Connection name is AS400
-
Oct 2nd, 2001, 11:20 AM
#5
Member
Here is a connection string that works for me.
Set dbMyODBCDB = DBEngine(0).OpenDatabase _
("", False, False, "ODBC;DSN=AS400 ODBC;;TABLE=XXX@@XXXX.XXXXX;UID=;PWD=") 'Publishers")
tHE dsN WILL BE WHATEVER YOU NAMED IT THE xxxx@@@xxxx.xxxxx IS THE NAME OF THE DEFAULT as400 LIBRARIES AS DEFINED BY THE SYSTEM OPERATOR./
-
Oct 2nd, 2001, 11:55 AM
#6
Thread Starter
Lively Member
hey packman,
you said that I must set up a ODBC connection.. how is this done.. I know that the driver is the name that I give the odbc within the client access... but I am confused about the DSN.
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
-
Oct 2nd, 2001, 12:08 PM
#7
Lively Member
ODBC connection
-From the Windows atart menu
-Go to settings
-then go to control panel
-ODBC datasources and open it
-go to System DSN tab
-click the add button
-choose the driver: Client Access ODBC
-go to the General Tab and DSN should be whatever your connection DSN is (as400)
-Under the Server Tab: type in the default Library.
There are other setting. However, normally I only have to modify the afformentioned.
-
Oct 2nd, 2001, 12:15 PM
#8
Thread Starter
Lively Member
so the DSn is the data source ... t And i know this may seem stupid but the area in the connection string.. for Driver.. what is this suppose to be...
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
-
Oct 2nd, 2001, 12:21 PM
#9
Lively Member
Driver
Thats the name of the Driver that you should have loaded on your PC. When you set up the ODBC connection it will give you a list of drivers to choose from. To ref that driver in code:
Driver = {client Access ODBC data source}
-
Oct 2nd, 2001, 12:27 PM
#10
Thread Starter
Lively Member
i have done the code (packman) and I received this error..
[IBM][Client Access ODBC Driver (32 bit)][DB2/400] Communication Link Failure, Comm RC=0x5
here is my code
Dim connAS400 As ADODB.Connection
Dim rsAS400 As ADODB.Recordset
Set connAS400 = New ADODB.Connection
Set rsAS400 = New ADODB.Recordset
connAS400.ConnectionString = "DSN=AS400;DRIVER={client access ODBC data source};SERVER=todc88;database=altdelca.apt171la;UID=@@@@;PWD=@@@@;"
connAS400.Open
Set rsAS400.ActiveConnection = connAS400
rsAS400.LockType = adLockBatchOptimistic
rsAS400.CursorType = adOpenKeyset
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
-
Oct 2nd, 2001, 12:39 PM
#11
Lively Member
Database name
In the AS400 world the Database name is referred to as the Library. Do you have a library named "altdelca.apt171la".
Also, is that actually your pwd and userid?
-
Oct 2nd, 2001, 01:14 PM
#12
Thread Starter
Lively Member
yes there is a library named that and the passwrod and userid are in the program.. i did not enter them here for work security purposes.
but isthe part about the driver suppose to be just like that
Madeline
Just remember this "Until you do what you believe in, you don't know whether you believe it or not"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|