I have searched the archive and still have been stumped.

I went through the process of creating an entry in the RDB using ADDRDBDIRE
RDB(MYDSN) RMTLOCNAME(*LOCAL)

When I signon to our AS400 using my userid and password and go into sql
(STRSQL) I can do a "SET CONNECTION MYDSN" and I get a "Current connection
is to Relational Database MYDSN". Otherwise I connect.

I can create an ODBC connection on my local pc and run the agent fine
locally.

If I run a scheduled agent on the AS400 If tells me I cannot connect.

Below is a simple script that I wrote to just see if I could connect and I
could not.

Any Ideas of what I am failing to do would greatly be appreciated.

Thanks

Bruce "Hoss" Collins


(Options)

Option Public
Uselsx "*LSXODBC"

(Declartions)

Const DSN="MYDSN"
Const Username = "HOSS"
Const Password = "mypassword"

(Initialization)

Sub Initialize
      Dim con As New ODBCConnection
      Dim UserName As String
      Dim Password As String
      Dim msg As String

      Messagebox "Using DSN " & DSN
      Messagebox "Call "
      Call con.connectTo(dsn, UserName, Password)
      If Not con.ConnectTo(dsn, UserName, Password) Then
            Messagebox "Not Conneted Using " & DSN
            Exit Sub
      Else
            Messagebox "Connected Using " & DSN
      End If


      tables = con.ListTables(dsn)
      msg = dsn & " contains the following _tables:" & Chr(10)
      For n% = Lbound(tables) To Ubound(tables)
            msg = msg & Chr(10) & tables(n%)
      Next
      Messagebox msg,, "Tables for " & dsn
      con.Disconnect

End Sub






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.