Getting the Db2 for i .NET Data Provider Up and Running
- Invoke Db2 for i embedded SQL or Db2 for i stored procedures from c# on your Windows PC using any version of Visual Studio IDE
- get interactive web pages fast using .NET Framework web site or web application project template from Visual Studio (this is what we do)
- works within a fat client .exe also
- works within a class or stand-alone namespace by referencing the IBM.Data.DB2.iSeries namespace
- Easily deploy/implement your web site or web application project on Windows IIS web server
- Make your project accessible by most any web browser worldwide without any special requirements on user PCs. Similarly, the .NET Framework or Windows is not required on the end user's PC.
(a true zero-footprint client on the user's PC requires no additional installation or setup requirements beyond the browser itself)
- Installing and Specifying Settings (Plumbing)(Call Us if you get stuck!)
- the latest version of IBM i ACS is Version - 1.1.9.7, however the current latest version of the .dll was first released with Version - V1.1.9.5, Build id: 4152 (release date April 8th, 2024). The .dll is always released separately in the Windows Application Package (or WindowsAP), in a separate zip file from the main ACS zip file. The .dll file version shows 13.0.26.0 (in Windows/assembly). When installed (a setup.exe must be run), it shows as IBM i Access Client Solutions - Application Package 11.28.00 (in Windows|Settings|Apps and Features).
- for a .NET Framework website project (or web app project) needing access to Db2 for i, installation of the Db2 for i .NET
Data Provider is the only component group that is required on development workstations and the only component group required on Windows IIS web server. The OLE DB Provider can be installed on the workstation to enable automatic creation of external data structures, actually OO style objects, via drag and drop.
So specify a custom install as shown in the picture when running the setup.exe in IBM i ACS Windows Application Package
- In other
words, please do not take the default installation options when installing the IBM i ACS Windows Application Package, especially on Windows Server. By installing everything, the result can be that a number of extra things that you don't need get installed, those being the ODBC driver, at least for this purpose, and the OLE DB Provider. Not only is not installing everything considered best practice (lean and mean is the best path to a sturdy and fast Windows Server build), but it reduces unknowns or unused duplicates for your Windows Server admin(s) and reduces the chance you'll get saddled with roadblocks or prerequisite hurdles (OK, sorry for the sermon).
- To enable drag and drop from Db2 for i physical files and external data structures into new OO DataSets at design time in Visual Studio, install the OLE DB Provider on the workstation also. The OLE DB Provider is not needed at run time, so again, please do not install the OLE DB Provider on Windows Server for this purpose. Of course we are assuming the developers aren't using Visual Studio to develop directly on Windows Server (LOL). The OLE DB Provider is not required to dynamically create a list of columns in an OO DataSet at run time based on the columns in a Db2 for i SQL statement or Stored Procedure declared cursor. However, the OO DataSet is rather useful when programming the highest level of optimistic concurrency based on only a subset of columns...
- Let us help you with Q&A, providing examples or custom development contracting
- We can help you formulate strategy, train your resources or do the development
- Or come out and see us doing one of our presentations on the topic at a COMMON conference such as POWERUp 2025
- Get the full scoop in our new tutorial, training and source code bundle, Get Running - Tegratecs Code Package - Pro Intro Module
- The SQL features available to use will be based on the target IBM i server OS level, so the latest and greatest stuff from IBM i 7.4 and 7.5 will be available (if installed on your target IBM i machine)
- For compiling of the project, the .dll will work with .NET Framework projects compiled all the way up to the latest, which is .NET Framework 4.8 The Db2 for i .NET Provider does not work with .NET Core.
- In some cases, when targeting older versions of the FW and/or using old versions of the .dll and/or targeting an old version of IBM i, special web.config syntax may be required, please contact us if you experience problems.
- connection strings can take advantage of *LIBL technique (probably only with Db2 for i version)
- Eliminate library and schema and testing-based SQL hard-coding with library list technique in a Windows development environment!
Please use the Contact Us phone number and extension for a no-cost, no-obligation discussion.
See this article from MC Press for good details on setting the path and using *LIBL and system naming versus SQL naming
- Here is a connection string example from a web.config file, based on a working production version, using the library list technique. Remember to create your stored procedure and SQL PL with compatible syntax and options based on the system naming technique. Always compile (regardless of compiling native or in IBM ACS Run SQL Scripts) using *ISO data format if using TIMESTAMP data type. Long passwords with lower case can be used if the IBM i OS setting enables it... A specially powered profile (or compile attribute such as USRPRF(*OWNER) is not required to use embedded SQL or stored procedures in an application.
-
<connectionStrings>
-
<add name="strDotNetDB2iCnnName"
connectionString="DataSource=192.168.1.10; UserID=USRPRFNAME; Password=USRPRFPWD; Naming=System; LibraryList=LIBNAME1,LIBNAM2,LIBNAM3;"/>
-
</connectionStrings>
- Use inline SQL or stored procedure calls
- Use Equivalent Constructs as with Other Data Providers for .NET Environment
- define methods for Db2 for i access at the same scope and with the same functional equivalent as with those for MS SQL Server
- most adapters are supported
- your choice of whether to use system column names, ALIAS names or SQL column names
- populate and work with .NET FW OO DataSet objects that were created via drag and drop from Db2 for i file columns and subsets
- we like to characterize DataSet objects as multi-occurrence data structures on steroids
- for those really wanting column name verification and intellisense for column names at design/programming time, you can use these OO DataSets to qualify columns with the same name as the database column name (OO feature we got working with both Db2 for i and MSSQL). Similarly, this prevents run-time errors due to typos in referencing the columns by hand-typed array-element name. Purist MVC followers probably won't like this, but we selected web forms based on the .NET Framework to get an integrated web UI and a GUI web page design capability quite a while back.
|
develop on your workstation using any version of Microsoft Visual Studio
(link to Microsoft) free Community Edition download options (free license for individuals* etc.)
deploy your website or web application project to production on Microsoft IIS web server (it's a piece of cake!)
(link to) Ultimate Guide to IIS Server: What Is IIS? IIS Tutorial
The Db2 for i database is enhanced and updated by IBM on a regular basis, so there are new features and capabilities coming regularly, such as these...
(link to article on ibm.com) IBM i 7.5 - Base Enhancements
(link to article on ibm.com) Integrating Watson into Db2 for i in the area of Geospatial Functions
(link to) MC Press Online article IBM i 7.4 Hot New Features Unveiled...
- Let us help you with development services or to supply examples
- We can help you formulate strategy, train your resources or do the development
|