At the resource tier , creating a shared database between the Microsoft .NET Framework and Java 2 Enterprise Edition (J2EE) can be one of the simplest yet most effective ways of achieving interoperability between the two platforms. Database connectivity lies at the core of both .NET and J2EE, and with data access drivers available for each, it's relatively easy to create applications that share fields, records, and tables among both platforms.
Chapter 2, "Business Requirements for Interoperability," introduced the common scenario of business tier resource sharing. That chapter featured an example that built an application in .NET that shared the same data as an application that already existed in J2EE.
In previous projects I've worked on, I've observed how certain functionality has been added to an existing application where a requirement to keep the same data but use technology from a different platform was made. For example, with a reporting application, the reporting software is written for a different platform than the original application.
In this chapter, we'll look at data access in the context of both .NET and J2EE and explore two connectivity options. To enable this connectivity, we'll explore accessing Microsoft SQL Server 2000 from J2EE by using JDBC and from .NET by using Microsoft ADO.NET. To run the samples, you'll need a local installation of Microsoft SQL Server 2000. Service Pack 3 is recommended.
Although both samples presented in this chapter are based on the connection and sharing of data based on Microsoft SQL Server, these samples certainly aren't limited to products from a single vendor. Both JDBC and ADO.NET drivers are available for a number of database providers ”hence the term open data access , which you'll see throughout this chapter. The chapter will provide an introduction to JDBC and ADO.NET, but because the topic of accessing databases has been widely covered in other programming books and documentation, we'll stick to the context of using a shared database.
To conclude the chapter, we'll look at using a data access pattern that can be applied to both .NET and J2EE and cover the advantages of doing so.