×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Chris,

Thanks for all your help. With what you've given me and the references,
I should be able to get this to work before I pull all my hair out.

Lee

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Wednesday, September 16, 2009 2:23 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] IIS server not sending user id

Lee, check this out:
http://www.innovativesys.net/?cat=17

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Tuesday, September 15, 2009 10:58 AM
To: .net use with the System i
Subject: Re: [SystemiDotNet] IIS server not sending user id

Lee, take a look at the "IBM DB2 UDB for iSeries .NET Provider Technical
Reference". There are many samples of how to use the classes. I would
also recommend getting paper copies of ISBN 0738490555 and ISBN
0738496561.

Create a new class file in your project.

Paste this code in there:

Imports IBM.Data.DB2.iSeries
Imports System.Data

Public Class DB2ADO


Private _cn_connString As String = ""
Private _cn As iDB2Connection
Private _cn_iSeriesFQDN As String = "myIseries.domain.com"
Private _cn_initialCatalog As String = "*SYSBAS" ' "s10913ce"

Private _cn_connTimeout As String = "20"
Private _cn_user As String = ""
Private _cn_pass As String = ""
Private _cn_SSL As String = "FALSE"
Private _cn_Naming As String = "SQL" ' "System"
Private _cn_LibraryList = "*USRLIBL"
Private _cn_DataCompression = "TRUE"
Private _cn_HexParser = "Character" ' Not needed

Private _ConvertByte As Boolean = False
'Private _cn_defaultCollection As String = "AMFLIB"


' Trace Facility
Private _trace_bin As String = "C:\program files\ibm\Client
Access\cwbmptrc.exe"
Private _trace_out As String = "C:\program files\ibm\Client
Access\idb2trace.txt"

Public Sub New(ByVal iSeriesFQDN As String, ByVal user As String,
ByVal pass As String, Optional ByVal ConvertByte As Boolean = True)
_cn_iSeriesFQDN = iSeriesFQDN
_cn_user = user
_cn_pass = pass
_ConvertByte = ConvertByte

_cn_connString = "DataSource=" & _cn_iSeriesFQDN & _
";ConnectionTimeout=" & _cn_connTimeout & _
";Database=" & _cn_initialCatalog & _
";HexParserOption=" & _cn_HexParser & _
";UserID=" & _cn_user & _
";Password=" & _cn_pass & _
";SSL=" & _cn_SSL & _
";DataCompression=" & _cn_DataCompression & _
";Naming=" & _cn_Naming & _
";LibraryList=" & _cn_LibraryList

_cn_pass = ""

End Sub

Public Function Connect() As Boolean
_cn = New iDB2Connection
_cn.ConnectionString = _cn_connString

Dim failFlag As Boolean = True

Try
_cn.Open()
Console.WriteLine("Server Version: " & _cn.ServerVersion)
Console.WriteLine("Default Collection: " &
_cn.DefaultCollection)
Console.WriteLine("Job: " & _cn.JobName)
Catch ex As Exception
failFlag = False
End Try

Return failFlag
End Function

Public Sub Disconnect()
_cn.Close()
End Sub

Public Function Query(ByVal SelectCommand As String) As DataTable
If _cn.State = ConnectionState.Open Then

If _ConvertByte Then
iDB2ProviderSettings.CharBitDataAsString = True ' TODO:
thank you
iDB2ProviderSettings.CharBitDataCcsid = 37
Else
iDB2ProviderSettings.CharBitDataAsString = False
End If

Dim cmd As New iDB2Command(SelectCommand, _cn)
Dim da As New iDB2DataAdapter(cmd)
Dim ds As New DataSet

Try

da.Fill(ds, "table0")

If ds.Tables("table0").Rows.Count = 0 Then
Return New DataTable
ElseIf ds.Tables("table0").Rows.Count > 0 Then
Return ds.Tables("table0")

End If


Catch ex As Exception
Console.WriteLine(ex.Message)
Return New DataTable
End Try

Else
Return New DataTable
End If
End Function

End Class



Then in your _default class you can do this:

Dim myProvider as new DB2ADO("yourISeries.yourDomain.Com", "user",
"pass")
If myProvider.Connect Then
Dim dt as System.Data.DataTable = myProvider.Query("select *
from customerTable")
myProvider.Disconnect()
End If
--
This is the .net use with the System i (SystemiDotNet) mailing list To
post a message email: SystemiDotNet@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/systemidotnet.
--
This is the .net use with the System i (SystemiDotNet) mailing list To
post a message email: SystemiDotNet@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/systemidotnet.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.