• Topic
  • Discussion
  • VirtuosoWikiWeb.VirtOJDBCEntityFrameworkUsage(Last) -- Owiki? , 2016-08-19 15:01:38 Edit owiki 2016-08-19 15:01:38

    Using Microsoft Entity Frameworks to Access ODBC to JDBC Bridge Schema Objects with Virtuoso

    This document details the steps required to provide Microsoft Entity Framework access to ODBC to JDBC Bridge Schema Objects using the OpenLink Virtuoso Universal Server. This is achieved by linking the required ODBC to JDBC Bridge Schema objects into Virtuoso using its built-in Virtual Database engine, and then using the Virtuoso ADO.NET Entity Framework provider to query the remote ODBC to JDBC Bridge Schema objects linked into the Virtuoso Server.

    Prerequisites

    The following prerequisites must be in place for this solution to be possible.

    ODBC to JDBC Bridge DBMS

    An ODBC to JDBC Bridge DBMS hosting the required Schema Objects needs to be available. In this document we shall make an ODBC to JDBC bridge connection to another Virtuoso Northwind Demo database to demonstrate the process.

    ODBC to JDBC Bridge Driver

    An ODBC to JDBC Bridge Driver is required for Linking the ODBC to JDBC Bridge Schema Objects into the Virtuoso Server. The OpenLink ODBC to JDBC Bridge Driver will be used in this document, for which a functional ODBC Data source name of jdbcma will be assumed to exist on the machine hosting the Virtuoso Server.

    Virtuoso Universal Server

    A Virtuoso installation including the Virtuoso Universal Server and ADO.NET Entity Framework Provider is required. The Virtuoso components used must be Release 5.10.x or above, this being the minimum version containing support for Microsoft Entity Frameworks.

    Microsoft Visual Studio 2008 SP1

    Microsoft Visual Studio 2008 Service Pack 1 is required, this being the only version containing the necessary Entity Framework support available at the time of writing.

    Tasks

    Ensure ODBC to JDBC Bridge Primary Keys (PKs) are not nullable

    The Visual Studio 2008 Entity Data Model (EDM) requires that all primary keys are *NOT* Nullable. Visual Studio will fail to generate an EDM, if any are. Therefore, ensure any primary keys to be used are defined as not nullable in the ODBC to JDBC Bridge database schema, before attempting to generate an EDM. In the case of the ODBC to JDBC Bridge Virtuoso Northwind Demo database, all primary keys are not nullable. Thus, this should not be an issue in this case.

    Install and configure OpenLink ODBC to JDBC Bridge Driver

    The Virtuoso Virtual Database engine uses ODBC as the connectivity mechanism for linking remote database objects into its local schema. Thus, an ODBC to JDBC Bridge Driver must be available with a suitably configured DSN for connecting to the target database. The OpenLink ODBC to JDBC Bridge Drivers have been used in this document, although in theory any ODBC to JDBC Bridge Driver can be used.

    Installation instructions for the OpenLink ODBC to JDBC Bridge Driver are available from:

    Install and configure OpenLink Virtuoso Universal Server

    Linking ODBC to JDBC Bridge tables into Virtuoso

    Creating a Visual Studio hosted Entity Data Model (EDM)

    Using EDM to create Entity Framework based applications

    Now that a Microsoft Entity Data Model has been created for the ODBC to JDBC Bridge Virtuoso Northwind Demo database, Entity Framework applications can be created to make use of it.

    Entity Frameworks based ADO.NET Data Service
    Visual Studio Windows Form Application

    Referenced by...