Use
the Create OLE DB Table Function wizard to create an OLE DB
user-defined table function that allows you import data from a database
that
supports the OLE DB format.
Prerequisites:- DB2® Universal Database™ for Linux®, UNIX®,
and Windows®, Enterprise Server Edition (Version
8 and later)
- OLE DB 2.0 or later, available from Microsoft® at http://www.microsoft.com.
If you attempt to invoke
an OLE DB table function without first installing OLE DB, DB2® issues
SQLCODE
-465, SQLSTATE 58032, reason code 35. For the system requirements
and OLE
DB providers available for your data sources, refer to your data source
documentation.
For the OLE DB specification, see the Microsoft OLE
DB 2.0 Programmer's
Reference and Data Access SDK, Microsoft Press,
1998.
- db2olefn.dll must be registered
on your computer.
To register this DLL file, enter regsvr32 DB2installdir\sqllib\function\db2olefn.dll on
a command line, where DB2installdir is the root
directory
where you installed DB2.
To create a UDF for OLE DB:
- Switch
to the Data perspective.
- Click File
> New > Other to open the New
dialog.
- Select Data and
choose User-Defined
Function.
- Click Next. The wizard
opens.
- On the Specify a Project page,
choose to
use a new project or select an existing data development project.
- Click Next. The Name
and Language page opens.
- In
the Language field, select OLE DB.
- Complete the necessary steps of the wizard.
- Click Finish.
The user-defined function is created and added
to the data development
project that you specified, and the user-defined function is deployed
and
registered on the database server.