ASP .NET & DB2

  • Thread starter Thread starter Antoni Massó Mola
  • Start date Start date
A

Antoni Massó Mola

I need to connect to my DB2 Server 8.1.3 through ASP .NET pages.

Is there a method to connect to DB2 directly from ASP .NET code without
having to program it with C# or VB .NET?

I need to validate a Username & Password (from an aspx form) with the DB2
Database table Users.
 
Hi Rajiv,

I've tried to use the IBM OLE DB Provider for DB2. When I compile the C#
code it doesn't give me any error, but the ASP .NET page does:


Server Error in '/DeptEmployees' Application.
----------------------------------------------------------------------------
----

SQL30082N Attempt to establish connection failed with security reason "17"
("UNSUPPORTED FUNCTION"). SQLSTATE=08001
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: SQL30082N Attempt to
establish connection failed with security reason "17" ("UNSUPPORTED
FUNCTION"). SQLSTATE=08001

Line 41: db2DataAdapter2.Fill(db2DataSet11);

Any idea what this error might be?
 
I found this c# code, can anyone explain me how to edit it to be used with
DB2?

namespace HowTo.Samples.ADONET
{

using System;
using System.Data.SqlClient;
using System.Data.Db2Client;

public class adooverview1
{
public static void Main()
{
adooverview1 myadooverview1 = new adooverview1();
myadooverview1.Run();
}

public void Run()
{


SqlConnection mySqlConnection = new SqlConnection("Database=SAMPLE;User
ID=administrator; Password=evc++;Server=trilium-1:50000");

try
{
mySqlConnection.Open();
Console.WriteLine("Opened Connection to {0}",
mySqlConnection.ConnectionString);

// Close the connection explicitly
mySqlConnection.Close();
Console.WriteLine("Closed Connection. It is important to close
connections explicitly.");
}
catch
{
Console.WriteLine("Couldn't Open Connection to {0}",
mySqlConnection.ConnectionString);
}
}
}

}
 
I found out:

OleDbConnection mySqlConnection = new
OleDbConnection("Provider=IBMDADB2.1;Data Source=SAMPLE;User
ID=administrator;Password=xxxxxxx;Network Address=xxx.xxx.xxx.xxx");
 
congrats! :)

--
Cheers!
Rajiv. R
Rajspace.Org
Antoni Massó Mola said:
I found out:

OleDbConnection mySqlConnection = new
OleDbConnection("Provider=IBMDADB2.1;Data Source=SAMPLE;User
ID=administrator;Password=xxxxxxx;Network Address=xxx.xxx.xxx.xxx");


http://groups.google.co.in/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=OJOh62
puBHA.2564%40tkmsftngp04&rnum=1&prev=/groups%3Fq%3Dasp.net%2Band%2Bdb2%26hl%
3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3DOJOh62puBHA.2564%2540tkmsftn
 
Back
Top