× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Walden, what API are you referring to
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=
/rzaik/rzaikrccommapis.htm ? Isn't there a Kerberos service on the
iSeries? Couldn't we use the Windows token to authenticate against the
iSeries?

Lee, here is some sample .Net code (also, remember that any
communication between IIS ASP.NET code and the iSeries will be run as
Network Service user by default and not the user you login with to your
ASP.NET application):

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



'----------- storec proc testing

Public Function SP_Test1() As String
If _cn.State = ConnectionState.Open Then

Dim cmd As New iDB2Command("Test1",
CommandType.StoredProcedure, _cn)
cmd.Parameters.Add("@CustomerNumber",
iDB2DbType.iDB2Integer)
cmd.Parameters.Add("@TotalActivity", iDB2DbType.iDB2Decimal)
cmd.Parameters(0).Value = 55900
cmd.Parameters(1).Direction = ParameterDirection.Output

cmd.ExecuteNonQuery()
Return (" Para0 = " & cmd.Parameters(0).Value.ToString &
vbNewLine & " Para1 = " & cmd.Parameters(1).Value.ToString)

Else
Return "Connection Dead"
End If

End Function

Public Sub SP_Create()
If _cn.State = ConnectionState.Open Then
Dim cmd As iDB2Command
cmd = _cn.CreateCommand
cmd.CommandText = "create procedure amflib.Test2 (" & _
"in customernumber integer) result sets 1 language sql " & _
"begin " & _
" declare c1 cursor for select jqglva,extca,coqty,tdate
from " & _
" amflib.mthacte where cusno=customernumber; " & _
" open c1; " & _
" set result sets cursor c1; " & _
"end"

cmd.ExecuteNonQuery()
Else

End If
End Sub

Public Function SP_Test2(ByVal CustomerNumber As Integer) As
DataTable
If _cn.State = ConnectionState.Open Then

Dim cmd As New iDB2Command("Test2",
CommandType.StoredProcedure, _cn)
cmd.Parameters.Add("@CustomerNumber",
iDB2DbType.iDB2Integer)
cmd.Parameters(0).Value = CustomerNumber

Dim da As New iDB2DataAdapter(cmd)
Dim ds As New DataSet

da.Fill(ds, "table0")
Return ds.Tables("table0")
Else
Return New DataTable
End If
End Function


End Class

-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx
[mailto:systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Walden H.
Leverich
Sent: Monday, September 14, 2009 8:11 AM
To: .net use with the System i
Subject: Re: [SystemiDotNet] IIS server not sending user id

The login credentials you obtained from a form the user filled out? Just
use their username/password as part of the connection string.
Alternatively, since you can get the username from windows (just not the
password) you could use the get/set profile handle APIs on i to set the
"current" user to be the client's user name. This would enforce all the
correct data access, however, you'd have to do that at the start of each
connection.

-Walden



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-2024 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.