No one doubts the possibility of this!  We have been using it in production
for 16 months!  SAPDB is nothing special as far as ODBC goes.

The real issue is the reliability and performance overhead.  ODBC is the
slowest .NET solution, OLEDB and a "native driver" are best.

The SAPDB ODBC driver also seems to have high concurrency reliability
problems.  Especially with ASP.NET applications.  It is very difficult to
debug ODBC drivers...

  Stephen


-----Original Message-----
From: Carsten Kuckuk [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 31, 2003 9:51 AM
To: [EMAIL PROTECTED]
Subject: FYI - How to access SAP DB from a Microsoft .NET environment


Fellow list members,

A few weeks ago, the subject of accessing SAP DB from .NET came up. I 
spent some hours this weekend familiarizing myself with the relevant 
parts of .NET and the ODBC bridge and wrote up what you have to do in 
order to achieve this in an ADO.NET conform way. There were no problems 
involved except for having to spent hours with installing frameworks, 
SDKs, patches, and reading through reams of documentation in MS-speak.

HTH,

Carsten

======================================

http://www.kuckuk.com/public/tn/tn0016.html

How to access SAP DB from a Microsoft .NET environment

This technical note describes how to access a SAP DB database from a 
.NET program

Installed Software
I started with a clean installation of Windows 2000 Workstation. Then I 
used the built-in "Windows Update" to install all available service 
packs and patches. As for the .NET environment, I installed the 1.0 
version (service pack 2) as well as the 1.1 version of the .NET 
framework. On top of that I installed "ODBC .NET Data Provider" which 
according to the online documentation is part of the 1.1 framework, but 
needs to be installed separately for the 1.0 framework. In order to make 
this ODBC bridge happy, I also had to install MDAC 2.6 service pack 2.

For the database, I installed SAP DB 7.4.03.27 which I downloaded 
straight from the SAP DB web site. I installed the "all" package which 
includes the server, the clients, and some command line utilities. I ran 
the "create_demo_db" script and thusly created the TST database. I also 
installed DBM GUI and the SQL Studio. I used the system configuration 
tools to create an ODBC data source called "TST" which connects via the 
SAP DB ODBC driver to the TST database on server "localhost".

.NET Framework 1.0
As a .NET client, I used the application "ADO.NET Ad Hoc Query Tool" 
which comes on the acompanying CD to David Sceppa's book "Microsoft 
ADO.NET. Core Reference" from Microsoft Press. When I first started this 
tool, I had to select "<Add Provider>" as the .NET Data Provider. I was 
presented with a dialog box where I had to manually select the driver 
DLL. I chose 
c:\Programme\Microsoft.NET\Odbc.Net\Microsoft.Data.Odbc.Dll". After the 
ODBC driver was registered, I typed in "DSN=TST;UID=TEST;PWD=TEST" as 
the connection string and got a connection. As my first query I chose 
"select * from dual", pressed the "execute"-button and got the result I 
was looking for.

.NET Framework 1.1
With the release of .NET 1.1, the ODBC data provider got moved into the 
System.Data.Odbc Namespace and became part of the core framework. The 
following C# application shows how to access the SAP DB demo database:

// hello.cs (.NET framework 1.1)

using System;
using System.Data;
using System.Data.Odbc; // FW 1.0: Microsoft.Data.Odbc;

class hello
{
static void Main(string[] args)
{
string strConn = "DSN=TST;UID=TEST;PWD=TEST";
IDbConnection conn = new OdbcConnection(strConn);

conn.Open();

IDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT owner,tablename,type,tabletype FROM tables";

IDataReader reader = cmd.ExecuteReader();

try
{
while (reader.Read())
{
int n=reader.FieldCount;
for(int i=0; i<n; i++)
Console.Write(reader.GetString(i)+" ");
Console.WriteLine("");
}
}
finally
{
reader.Close();
conn.Close();
}

}
}

This code gets compiled from the command line with the following commands:

C:\home\ck>set 
path=c:\programme\microsoft.net\sdk\v1.1\bin\;c:\winnt\microsoft.
net\framework\v1.1.4322\;c:\programme\microsoft visual studio .net 
2003\vc7\bin\
;c:\programme\microsoft visual studio .net 
2003\common7\ide\;c:\winnt\system32\;
c:\winnt;c:\winnt\system32\whem

C:\home\ck>set LIB=c:\programme\microsoft visual studio .net 
2003\vc7\lib\;c:\pr
ogramme\microsoft.net\sdk\v1.1\lib\;

C:\home\ck>set INCLUDE=c:\programme\microsoft visual studio .net 
2003\vc7\includ
e\;c:\programme\microsoft.net\sdk\v1.1\include\;

C:\home\ck>csc hello
Microsoft (R) Visual C# .NET-Compilerversion 7.10.3052.4
f�r Microsoft (R) .NET Framework, Version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. Alle Rechte vorbehalten.

error CS2001: Die Quelldatei 'hello' konnte nicht gefunden werden
fatal error CS2008: Kein Eingaben wurden angegeben

C:\home\ck>csc hello.cs
Microsoft (R) Visual C# .NET-Compilerversion 7.10.3052.4
f�r Microsoft (R) .NET Framework, Version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. Alle Rechte vorbehalten.


C:\home\ck>




_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to