Connection String for AS/400

2405 pts.
Tags:
AS/400
AS/400 database
VB.NET
Hi all. Here I'm using iSeries Server. I just want to connect VB.NET with AS/400 database. Simply I want to retrieve some data from a PF on VB.NET. Anybody can you tell me what is the connection string should be used? If you have any simple sample code in VB.NET please post here... Surey

Software/Hardware used:
V6R1, visual studio 2008

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 11  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Before anyone can provide anything, we need to know what you are connecting with and what you are connecting to. What is the server OS version? What driver are you using? -- Tom
    125,585 pointsBadges:
    report
  • Sureyz
    Hi Tom .. 
    Server OS Version - V6R1M0 - i5/OS
    and driver is ODBC .. 
    
    You can suggest me which one is best driver. .
    
    2,405 pointsBadges:
    report
  • TomLiotta
    ...and driver is ODBC...   What ODBC driver? There is more than one possible to use. The first you should use is the IBM driver installed with iSeries Access. And iSeries Access should have the latest 6.1 service pack installed to ensure that you bypass any earlier issues that might have been found and fixed already.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    However, you might make better use of the IBM .NET data provider instead of the ODBC driver. -- Tom
    125,585 pointsBadges:
    report
  • Sureyz
    Hi Tom... Our iSeries Access is 7.1 ..  If u can please explain me bit detailed. .because first time i'm trying this.. what is the connection string should be used. ? and how to fetch the data ?ThanksSurey.
    2,405 pointsBadges:
    report
  • TomLiotta
    Please see Connection strings for AS/400 for different general formats. But we still don't know which ODBC driver you'll be using, nor do we know how you're going to use it. You should develop a basic test function at the least. Then if you run into an obstacle, show the code. -- Tom
    125,585 pointsBadges:
    report
  • Sureyz
    Hi Tom !this is my VB.NET code. Here I'm getting
    ERROR[HYT00][IBM][System Access ODBC Driver]Connection login timed out error.
    
    
    Imports System.Data.Odbc
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim cn As New OdbcConnection
            Dim cmd As New OdbcCommand
            Dim dbres As Integer
    
            Dim sql As String
            sql = "SELECT COUNT(*) FROM M1ATA00"
    
            Try
                cn.ConnectionString = "Driver={iSeries Access ODBC Driver};Data Source='Myiseries';System=XXXXXXXX;Uid='YYYYY';Pwd='ZZZZZ';"
                cn.Open()
                cmd.Connection = cn
                cmd.CommandType = CommandType.Text
                cmd.CommandText = sql
    
                dbres = Val(cmd.ExecuteScalar())
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    
            TextBox1.Text = dbres.ToString
            Exit Sub
    
            If dbres = 1 Then
                MessageBox.Show("Login Success")
            Else
                MessageBox.Show("Login Failed")
            End If
    
            cn.Close()
            cmd.Dispose()
            cn.Dispose()
        End Sub
    End Class
    2,405 pointsBadges:
    report
  • Sureyz
    Anybody ?
    2,405 pointsBadges:
    report
  • TomLiotta
    If the example is the code that you posted, what is "Data Source='Myiseries';"? I haven't seen that before, though it looks like a variation of a DSN parameter and I wouldn't expect a space to be valid. If you're using a DSN, then some of the other parameters can't be used. For "System=XXXXXXXX;", are using a host name or an IP address? -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    I added a comment, but it's not showing up. It's never clear why some comments seem to disappear. There's nothing in that comment that seemed unusual. There's a good chance it will be released in the morning and show up. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    In case my other comment doesn't show up, try removing the "Data Source" parameter. Tell us if a different error appears. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following