Interfacing Fedora with Microsoft SQL Server



Similar documents
I-Know 05 MEDINA. A Semi-automatic Dublin Core to MPEG-7 Converter for Collaboration and Knowledge Management in Multimedia Repositories

This guide specifies the required and supported system elements for the application.

Digital Asset Management System (DAMS) Infrastructure: A Collaborative Metadata Pilot. Presentation Overview

Driver for JDBC Implementation Guide

1. Database basics. 2. Central or distributed database. MonitorMagic Database Reference Version 1.2, November 2004

Using the Query Analyzer

AWS Schema Conversion Tool. User Guide Version 1.0

Using the SQL TAS v4

Spring,2015. Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE

SQL Server An Overview

MySQL for Beginners Ed 3

Database Migration from MySQL to RDM Server

Programming Database lectures for mathema

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

KonyOne Server Installer - Linux Release Notes

Jet Data Manager 2012 User Guide

Package sjdbc. R topics documented: February 20, 2015

Linas Virbalas Continuent, Inc.

Postgres Plus xdb Replication Server with Multi-Master User s Guide

AVALANCHE MC 5.3 AND DATABASE MANAGEMENT SYSTEMS

AWS Schema Conversion Tool. User Guide Version 1.0

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Installation Instructions for Version 8 (TS M1) of the SAS System for Microsoft Windows

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

Metadata for Evidence Based Medicine resources

COIN - Collaboration & Interoperability for Networked Enterprises Project N COIN Training Courses

ODBC Client Driver Help Kepware, Inc.

How To Create A Table In Sql (Ahem)

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

SQL. Short introduction

Database Extension 1.5 ez Publish Extension Manual

Toad Data Modeler - Features Matrix

DataFlex Connectivity Kit For ODBC User's Guide. Version 2.2

How To Write A Blog Post On A Web Page

Tracking Database Schema Changes. Guidelines on database versioning using Devart tools

ITG Software Engineering

A Migration Methodology of Transferring Database Structures and Data

Plug-In for Informatica Guide

RDS Migration Tool Customer FAQ Updated 7/23/2015

Product: DQ Order Manager Release Notes

OLH: Oracle Loader for Hadoop OSCH: Oracle SQL Connector for Hadoop Distributed File System (HDFS)

SQL Object Level Recovery Native 1.1

Using Temporary Tables to Improve Performance for SQL Data Services

Chancery SMS Database Split

Customer Bank Account Management System Technical Specification Document

SQL Server Training Course Content

!"# $ %& '( ! %& $ ' &)* + ! * $, $ (, ( '! -,) (# *&23. mysql> select * from from clienti;

SpagoBI exo Tomcat Installation Manual

A Brief Introduction to MySQL

StruxureWare Power Monitoring Database Upgrade FAQ

Database Assessment. Vulnerability Assessment Course

MySQL Job Scheduling

Table of contents. Reverse-engineers a database to Grails domain classes.

Architecting the Future of Big Data

Advance DBMS. Structured Query Language (SQL)

IBM Campaign Version-independent Integration with IBM Engage Version 1 Release 3 April 8, Integration Guide IBM

4 Logical Design : RDM Schema Definition with SQL / DDL

Create a Database Driven Application

Using SQL Server Management Studio

How To Use The Listerv Maestro With A Different Database On A Different System (Oracle) On A New Computer (Orora)

Sisense. Product Highlights.

The SkySQL Administration Console

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Microsoft SQL Server Connector for Apache Hadoop Version 1.0. User Guide

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

Database Query 1: SQL Basics

B.1 Database Design and Definition

IT2305 Database Systems I (Compulsory)

Java and RDBMS. Married with issues. Database constraints

Using SQL Developer. Copyright 2008, Oracle. All rights reserved.

IBM Campaign and IBM Silverpop Engage Version 1 Release 2 August 31, Integration Guide IBM

STREAMEZZO RICH MEDIA SERVER

An Oracle White Paper June Migrating Applications and Databases with Oracle Database 12c

Using Netbeans and the Derby Database for Projects Contents

Architecting the Future of Big Data

Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)

MS ACCESS DATABASE DATA TYPES

Instant SQL Programming

CONVERTING FROM NETKEEPER ISAM v6.32 to NETKEEPER SQL

php tek 2006 in Orlando Florida Lukas Kahwe Smith

Visual Basic. murach's TRAINING & REFERENCE

Matisse Installation Guide for MS Windows. 10th Edition

Chapter 30 Exporting Inventory Management System Data

Using ODBC with MDaemon 6.5

System Requirements for Dynamics GP 2013

Knocker main application User manual

System Requirements for Microsoft Dynamics GP 2013

Specialized Programme on Web Application Development using Open Source Tools

Data Migration from Magento 1 to Magento 2 Including ParadoxLabs Authorize.Net CIM Plugin Last Updated Jan 4, 2016

DBX. SQL database extension for Splunk. Siegfried Puchbauer

Postgres Plus Migration Guide

Getting Started with Telerik Data Access. Contents

2015, André Melancia (Andy.PT) 1

Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

Information Technology NVEQ Level 2 Class X IT207-NQ2012-Database Development (Basic) Student s Handbook

Oracle Data Integrator integration with OBIEE

Data Access Guide. BusinessObjects 11. Windows and UNIX

What's New with SQL Developer Data Modeler. Heli Helskyaho HrOUG 2015

Transcription:

Interfacing Fedora with Microsoft SQL Server David Handy - Developer Wayne Simpson - Software Architect/Engineer Technology Enhancement and Software Services Idaho National Laboratory 1 - Introduction The Idaho National Laboratory Research Library is in the process of digitizing a large portion of their collections. As part of this effort, a little more than fifty years worth of reports written by INL s researchers are being scanned and converted to PDF format. Up until this point, these documents have never been available in anything but hard copy. In order to facilitate access to these digitized documents, we have employed the use of Fedora the Flexible Extensible Digital Object Repository Architecture. 1 Fedora, by default, can work with a number of database engines, including MySQL, Oracle, and PostgreSQL, among others. For various reasons, it was decided that the best course of action was to use Microsoft SQL Server. Fedora does not support SQL Server, so this functionality needed to be added. Fedora s documentation suggests two possible methods for successfully using a database other than those Fedora is natively set-up to use. 2 The Commons. http://fedorafirst method is to manually create a database. Whoever implements this method must add the tables, columns, keys, and so forth on their own. The second method is to write code that will convert Fedora s Data Description Language DDL) definition of the database to SQL that is specific to the target database engine. After writing an implementation of each method, it was concluded that the DDL Converter is the better of the two. It is more versatile and only needs to be written once. This paper contains details about how each method was implemented as well as conclusions drawn from the process. 2 - Implementation Details The source distribution of Fedora as well as a proper JDBC driver are required for either of the two solutions to work. This implementation uses the JTDS driver. 3 For the manual option, this driver must be placed in the application server as specified in the documentation see footnote 2). For the DDL Converter option, the driver can be placed in the lib directory of the source code. 1 To find more information about Fedora, see www.fedora-commons.org 2 Installation and Configuration Guide. Fedora commons.org/confluence/display/fcr30/installation +and+configuration+guide 3 Available at jtds.sourceforge.net

2.1 Manual Option The manual option was deemed easier of the two alternatives and by using the SQL Server s user interface, a database was manually created which followed the specification in DefaultDOManager.dbspec. 4 In order to make reproduction of the database easy, the database schema was exported as a SQL script, which is included in this document as Appendix 1. It was made for the Fedora 3.0 Beta 1 release. Of note, the process of creating database schemas is beyond the scope of this document. Readers who are unfamiliar with database management are encouraged to consult documentation describing the basics of database creation. 5 To continue, Fedora s database schema can change from version to version; therefore, this exercise may need to be repeated each time one desires to upgrade to a newer version. 2.2 DDL Converter Since a given implementation of the manual option only works for the version of Fedora for which it was created, implementing the Data Description Language DDL) Converter option was more desirable. This allows Fedora to programmatically create and alter the database schema, which means less extra work when upgrading to newer versions. The first step was examining the java source for the MySQL DDL Converter. 6 This code was used as a template for the new class called MsSQLDDLConverter.java. It needed to be edited to conform to SQL Server s version of schema creation syntax, since all SQL database engines handle the creation of tables differently. Required changes included the syntax of specifying binary data, primary and foreign keys and other constraints. The source code for the DDL Converter is included in this document as Appendix 2. 3 Conclusion The DDL Converter is the better option in the long run. Although it requires more thought, it only needs to be done once. Creating a DDL converter is not, however, the only step in the process. For both options, there is still a significant amount of configuration that has to be done manually in the server s configuration file. Sufficient time has not been invested yet into adding the new database engine to the Fedora installer, which would automatically set up the database the way it does with the native database engines. Currently, Fedora must be installed with a database it recognizes such as MySQL. The person installing must then go and point Fedora to the new database by editing fedora.fcfg. Further work is needed to add this option to the automatic installation process and remove the hassle. One would hope that doing so would involve only a slight modification of the source code. For now, though, the work done is counted as a success and further development in this venture will be continued. 4 The full path in the source distribution is src/dbspec/server/fedora/server/storage/resources/ DefaultDOManager.dbspec 5 See Microsoft s Books Online at http://msdn.microsoft.com/enus/library/bb418471%28sql.10%29.aspx 6 This can be found in /src/java/fedora/server/utilities/mysqlddlconverte r.java.

Appendix 1 SQL Script for Manually Creating SQL Server Database The following script will add all necessary tables to a database. It follows the schema outlined in the Fedora 3.0 Beta 1 release. object_idn'[fedoraadmin].[datastreampaths]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[datastreampaths] object_idn'[fedoraadmin].[dcdates]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[dcdates] object_idn'[fedoraadmin].[dofields]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[dofields] object_idn'[fedoraadmin].[doregistry]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[doregistry] object_idn'[fedoraadmin].[modeldeploymentmap]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[modeldeploymentmap] object_idn'[fedoraadmin].[objectpaths]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[objectpaths] object_idn'[fedoraadmin].[pidgen]') and OBJECTPROPERTYid, N'IsUserTable') = 1) drop table [fedoraadmin].[pidgen] CREATE TABLE [fedoraadmin].[datastreampaths] [tokendbid] [int] IDENTITY 1, 1) NOT NULL, [token] [varchar] 199) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [path] [varchar] 255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

CREATE TABLE [fedoraadmin].[dcdates] [pid] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [dcdate] [bigint] NOT NULL CREATE TABLE [fedoraadmin].[dofields] [pid] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [label] [varchar] 255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [state] [varchar] 1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [ownerid] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [cdate] [bigint] NOT NULL, [mdate] [bigint] NOT NULL, [dcmdate] [bigint] NULL, [dctitle] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dccreator] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcsubject] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcdescription] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcpublisher] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dccontributor] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcdate] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dctype] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcformat] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcidentifier] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcsource] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dclanguage] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcrelation] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dccoverage] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [dcrights] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL TEXTIMAGE_ON [PRIMARY] CREATE TABLE [fedoraadmin].[doregistry] [dopid] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [systemversion] [smallint] NOT NULL, [ownerid] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [objectstate] [varchar] 1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [label] [varchar] 255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CREATE TABLE [fedoraadmin].[modeldeploymentmap] [cmodel] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [sdef] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [sdep] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CREATE TABLE [fedoraadmin].[objectpaths] [tokendbid] [int] IDENTITY 1, 1) NOT NULL, [token] [varchar] 64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [path] [varchar] 255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL

CREATE TABLE [fedoraadmin].[pidgen] [namespace] [varchar] 255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [highestid] [int] NOT NULL ALTER TABLE [fedoraadmin].[datastreampaths] WITH NOCHECK ADD CONSTRAINT [PK_datastreamPaths] PRIMARY KEY CLUSTERED [tokendbid] ALTER TABLE [fedoraadmin].[doregistry] WITH NOCHECK ADD CONSTRAINT [PK_doRegistry] PRIMARY KEY CLUSTERED [dopid] ALTER TABLE [fedoraadmin].[objectpaths] WITH NOCHECK ADD CONSTRAINT [PK_objectPaths] PRIMARY KEY CLUSTERED [tokendbid] ALTER TABLE [fedoraadmin].[datastreampaths] ADD CONSTRAINT [DF datastrea token 7C8480AE] DEFAULT '') FOR [token], CONSTRAINT [DF datastream path 7D78A4E7] DEFAULT '') FOR [path], CONSTRAINT [DF_datastreamPaths_token] UNIQUE NONCLUSTERED [token] CREATE INDEX [IX_dcDates_pid] ON [fedoraadmin].[dcdates][pid]) ON [PRIMARY] ALTER TABLE [fedoraadmin].[dofields] ADD CONSTRAINT [DF dofields state 07020F21] DEFAULT 'A') FOR [state] CREATE INDEX [IX_doFields_pid] ON [fedoraadmin].[dofields][pid]) ON [PRIMARY] ALTER TABLE [fedoraadmin].[doregistry] ADD CONSTRAINT [DF doregistr syste 014935CB] DEFAULT '0') FOR [systemversion], CONSTRAINT [DF doregistr objec 023D5A04] DEFAULT 'A') FOR [objectstate], CONSTRAINT [DF doregistr label 03317E3D] DEFAULT '') FOR [label]

ALTER TABLE [fedoraadmin].[objectpaths] ADD CONSTRAINT [DF objectpat token 77BFCB91] DEFAULT '') FOR [token], CONSTRAINT [DF objectpath path 78B3EFCA] DEFAULT '') FOR [path], CONSTRAINT [DF_objectPaths_token] UNIQUE NONCLUSTERED [token]

Appendix 2 Source Code for MsSQLDDLConverter package fedora.server.utilities; import java.util.arraylist; import java.util.iterator; import java.util.list; /** * A DDLConverter for MS SQL Server. * * @author David Handy */ public class MsSQLDDLConverter implements DDLConverter public MsSQLDDLConverter) public boolean supportstabletype) return true; public String getdropddlstring command) String[] parts = command.split" "); String tablename = parts[2]; return "DROP TABLE " + tablename; public List<String> getddltablespec spec) StringBuffer out = new StringBuffer); StringBuffer end = new StringBuffer); StringBuffer indexes = new StringBuffer); out.append"create TABLE " + spec.getname) + " \n"); Iterator<ColumnSpec> csi = spec.columnspeciterator); int csnum = 0; while csi.hasnext)) if csnum > 0) out.append",\n"); csnum++; ColumnSpec cs = csi.next); out.append" "); out.appendcs.getname)); out.append' '); if cs.gettype).equalsignorecase"varchar"))

if cs.getbinary)) out.append"binary"); else out.appendcs.gettype)); else out.appendcs.gettype)); if cs.isnotnull)) out.append" NOT NULL"); if cs.isautoincremented)) out.append" IDENTITY 1, 1)"); if cs.getdefaultvalue)!= null) out.append" DEFAULT '"); out.appendcs.getdefaultvalue)); out.append"'"); if cs.isunique)) if!end.tostring).equals"")) end.append",\n"); end.append" CONSTRAINT"); end.appendcs.getname)); end.append"_unique UNIQUE KEY NONCLUSTERED "); end.appendcs.getname)); end.append" ON PRIMARY)"); if cs.getindexname)!= null) indexes.append" CREATE INDEX "); indexes.appendcs.getindexname)); indexes.append"on "); indexes.appendspec.getname)); indexes.append" "); indexes.appendcs.getname)); indexes.append") ON PRIMARY "); if cs.getforeigntablename)!= null) if!end.tostring).equals"")) end.append",\n"); end.append" CONSTRAINT "); end.appendcs.getname)); end.append"_fk FOREIGN KEY "); end.appendcs.getname)); end.append") REFERENCES "); end.appendcs.getforeigntablename)); end.append" "); end.appendcs.getforeigncolumnname));

end.append")"); if cs.getondeleteaction)!= null) end.append" ON DELETE "); end.appendcs.getondeleteaction)); if spec.getprimarycolumnname)!= null) end.append",\n CONSTRAINT "); end.appendspec.getname) + "_fk"); end.append" PRIMARY KEY CLUSTERED "); end.appendspec.getprimarycolumnname)); end.append")"); out.append"\n"); out.append") ON PRIMARY "); if!end.tostring).equals"")) out.append"\n ALTER TABLE "); out.appendspec.getname)); out.append" ADD \n"); out.appendend); out.append" "); if!indexes.tostring).equals"")) out.appendindexes); ArrayList<String> l = new ArrayList<String>); l.addout.tostring)); return l;