ASP .NET & DB2

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

Antoni Massó Mola

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?
 
A

Antoni Massó Mola

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);
}
}
}

}
 
A

Antoni Massó Mola

I found out:

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

Rajiv R

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top