What’s New in Microsoft SQL Server 2012 for Administrators & Developers
Microsoft SQL Server for IBM i Developers - Web400.com · • SQL Server Integration Services. 3...
Transcript of Microsoft SQL Server for IBM i Developers - Web400.com · • SQL Server Integration Services. 3...
Craig [email protected]
Copyright © 2014, Craig PelkieALL RIGHTS RESERVED
Microsoft SQL Server for IBM i Developers
2
Outline of this meeting
• Overview of Microsoft SQL Server
• SQL Server Features
• The SQL Server Management Studio
• The SQL Server Configuration Manager
• IBM i Database Providers and SQL Server
• Linked Sever to the IBM i
• Connecting with JDBC from IBM i to SQL Server
• SQL Server Reporting Services
• SQL Server Integration Services
3
What is Microsoft SQL Server?
• Windows database management system• Originally developed by Sybase• Microsoft / Sybase partnership through late 1980's• All-Microsoft product since early 1990's
• Versions of SQL Server• Obsolete and Older versions:
• SQL Server 6.5• SQL Server 7• SQL Server 2000• SQL Server 2005• SQL Server 2008• SQL Server 2008 R2
• Current versions:• SQL Server 2012• SQL Server 2014 CTP
Primary reference:http://www.microsoft.com/sql
4
SQL Server 2012 Editions
http://www.microsoft.com/en-us/sqlserver/editions.aspx
Edition Features
SQL Server 2012 Express No-chargeNot included
SQL Server Analysis Services (SSAS)SQL Server Integration Service (SSIS)
SQL Server 2012 Standard Targeted for small/medium business
SQL Server 2012 Business Intelligence Includes all features of StandardFeatures for BI / Analysis
SQL Server 2012 Enterprise Includes all features of Business Intelligence
SQL Server 2012 Enterprise Evaluation 180-day evaluation
SQL Server 2012 Developer Includes all features of EnterpriseLicensed for development only
SQL Server Features
5
Feature DescriptionSQL Server Database Services Core database engine
Replication – distribute data to multipledatabases
Full-text search – linguistic queries based on text data
Filestream — BLOB data stored in file system
SQL Server Analysis Services (SSAS) Online Analytical Processing (OLAP)
Data mining / Business Intelligence
SQL Server Reporting Services (SSRS) Web-based Report Manager / Report Server
Create / Manage / Distribute reports
Output to PDF / Word / Excel
SQL Server Integration Services (SSIS) Extract / Transform / Load (ETL) processing
Integrate data from multiple sources,to multiple destinations
Express Edition – can run but not create SSIS packages
SQL Server Management Studio
6Object Explorer Editor / Results / Messages Properties
SQL Server Configuration Manager
7
Connection Options, IBM i Access for Windows
• IBM i Access for Windows
• Licensed Program Products
• 57xx-XW1 – IBM i Access Family
• 57xx-XE1 – IBM i Access for Windows
• These providers are no-chargecomponents of IBM i Access
• Can be installed independentlyof other IBM i Access components
• 3 OLE DB Providers are installed:IBMDA400 – SQL supportIBMDARLA – Record Level AccessIBMDASQL – SQL, transactions
Provider IBM i Access VRM
ODBC V5R1+OLE DB V5R1+.NET V5R3+
8
Caution: be sure to matchthe “bit-edness” with yourenvironment (32/64)
Configure the IBMDA400 / IBMDASQL OLE DB provider
9
Go toServer Objects
Linked ServersProviders
IBMDA400 / IBMDASQL
Allow inprocess must be checkedfor the IBMDA400 / IBMDASQL
provider to work
Run an OPENROWSET query to the IBM i
10
The OPENROWSET query proves that SQL Server can connect to your IBM i.
It proves that the OLE DB database provider is configured correctly and is functional.
SELECT * FROM OPENROWSET ('IBMDA400', 'M270' ; 'QUSER' ; 'QUSER' ,'SELECT * FROM QIWS.QCUSTCDT')
SQL Server – Create a Linked Server
• Linked Server • Persistent object in SQL Server
• Represents a connection to another data source• Can be to another SQL Server• Can be to another type of database server that has an OLE DB Provider• OLE DB Provider is installed on the PC/server where SQL Server is installed
11
Configure the Linked Server
Select the IBMDA400 Provider
(any value)
TCP/IP Host Name of IBM i to link to
Valid Provider String for IBMDA400
Name that will be used within SQL Server for the Linked Server
http://www.connectionstrings.com
12
Trouble spot: Provider String
• Provider string that works for IBMDA400 / IBMDASQL
Catalog Library List=lib1,lib2,lib3,...;
• Notes• use spaces as separator in Catalog Library List keyword• use commas as delimiters in library list
• TO DO• IBM Technical Documentation pages on IBM i web site
Document Number 23062121
iSeries Access for Windows Custom Connection Properties for OLE DB
13
Review the Linked Server
• After you create the linked server, expand the Linked Server item
• If you don't see the server, press F5 or use the View, Refresh menu item to refresh the SQL Server Object Explorer
• If you see your linked server, expand it to see your tables
14
Picks up the Relational Database Directory Entry as the "Catalog" nameWRKRDBDIRE - Work with Relational Database Directory Entry
Note: if you have IASPs, each IASP is considered to have its own "database"Those database names are listed under Catalogs in the Object Explorer
Run a Query in SQL Server against a table in the Linked Server
15
SQL Server flags all of the column names (and the object name)as invalid in the Query Editor Window
Results of running the query (pass 1)
16
SQL Server selects only the character data fields
Results of running the query (pass 2)
17
Specify a SELECT * or the columns to select,the columns are now retrieved
Create a SQL Server Database
18
Populate a table in SQL Server with SELECT INTO from a Linked Server table
SELECT CUSNUM, LSTNAM, INIT, STREET
INTO SQL400.dbo.QCUST
FROM M270.S105HMNM.ADVWORKS.QCUSTCDT
Server name (TCP/IP Host Name)RDB name (WRKRDBDIRE)
Library nameTable name
19
Saving a script in SQL Server
20
The script to be saved
Use the File, Save As menu toprompt for a save-to directory and name
Conventional extension: .sql
You can open the saved script file inSQL Server Management Studio.Click the Execute button to run it.
Use the SQLCMD command to run a script
21
The sqlcmd command can be used to run a script file. The syntax for the command is:
sqlcmd -S server_name\instance_name -i c:\script_file_name.sql
where
-S identifies the following values as the server name and instance name
server_name - name of the SQL Server where the script is to be run
instance_name - is the instance of the SQL Server
-i identifies the following value as the name of the input file (the script)
c:\script_file_name.sql is the complete path and file name of the script file
The Microsoft SQL Server JDBC driver
• No-charge download from Microsoft
http://msdn.microsoft.com/en-us/sqlserver/aa937724/
(or go to Microsoft.com, search for "SQL Server JDBC")
• Download
Microsoft SQL Server JDBC Driver 3.0sqljdbc.jar - Java 1.x, Java 5sqljdbc4.jar - requires Java 6.0
• Install the .jar file to a directory in the IFS
• Set CLASSPATH to the .jar
22
Connect from IBM i using the JDBC Driver
23
private static ResultSet createResultSet(String customer) {
ResultSet rs = null;
try {Properties p = new Properties();p.put("user", "SQLTEST");p.put("Password", "sqltest");p.put("DatabaseName", "Northwind");
conn = DriverManager.getConnection("jdbc:sqlserver://host_name:1433", p);
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM Northwind.dbo.Customers");}
catch (Exception e) {System.err.println("Exception: " + e.getMessage());System.exit(EXIT_ERROR);
}
return rs;}
Connect to SQL Server from RPG
• Primary reference:
• Scott Klement’s work and articles on iProDeveloper.com
• www.iprodeveloper.com
• Search for JDBCR4
• How it works• Download / install JDBC driver from Microsoft• Download / install Scott’s service program code, examples• Configure Java environment• Create RPG programs using the service program
24
Connect to SQL Server from RPG
• Another tool:
• Dieter Bender’s AppServer4RPG and ArdGate (Application Request Driver)
• http://sourceforge.net/projects/appserver4rpg
• Also uses JDBC driver
• How it works• Download / install JDBC driver from Microsoft• Download / install AppServer4RPG code, samples• Configure Java environment• Create RPG programs using ArdGate API
25
What is SQL Server Reporting Services?
• Managed Reporting• Recurring reports• Often collates data from multiple data sources
• Ad-Hoc Reporting• Typically end-user driven• Generally one-time, relatively simple, time-dependent
• Embedded Reporting• Reports embedded within business apps / portals• Examples
• Reports linked to SharePoint Server• Report output to Excel
26
SSRS - Sample Report, list with sortable columns
27
This is a simple list-stylereport.
Many of the columns aresortable, by clicking thecolumn header text
SSRS - Dynamic expand/collapse (drill–down)
28
This report uses dynamic expansion and collapse for row groups
SSRS - Dynamic expand/collapse (drill–down) in Excel
29
Export the report to Excel, preserves the expand/collapse feature
SSRS - Document Map report
30
The Document Mapis displayed to theleft of the content
A document map provides a quicknavigation tool through a lengthyreport
SSRS - Summary data / graph / parameters
31
This shows a composite report that includes
• Parameters• Summarized data• Graphs
The summarized data and graphs can be drilled into to show the backing data.
SSRS - Report Delivery: File formats
• SSRS can render into:• HTML• PDF• CSV• XML• Image (TIFF)• Microsoft Office Word• Microsoft Office Excel
• Reports rendered into Word / Excel are fully editable documents, users can create custom documents based on the report
• Reports can also be emailed from SSRS as a file attachment of one of the supported file formats
32
SSRS - Report Delivery: Report Manager
33
The Report Manager is included with SSRS. It provides a web-based catalog of reports.
Users can view lists of reports they are allowed to access.
An alternative to Report Manager is SSRS integration with SharePoint Server.
Also, at least two appsavailable in Apple App Storefor iPhone / iPad
What is SQL Server Integration Services?
• Historically known as Data Transformation Services (DTS)• SQL Server 7.0, SQL Server 2000• SSIS first released with SQL Server 2005
• Data Import / Export• Flat file / database -> database / flat file
• Extract, Transform, Load (ETL)• Typically associated with database -> data warehouse• Transform, clean, de-dupe, data conformance
• Control Flow Engine• Control sequential / scripted execution of sequence of events• Supports conditional processing, error handling• Examples
• Download / upload• Rename, drop, create, index builds, backup
34
SSIS Package – Data Flow tasks
SSIS Package includes1..many Control Flow tasks
Dependencies between tasks can be set
Example: Task 1 must complete successfully before Task 2 runs
35
Summary
If you don't already have SQL Server in your shop
Or if you are working with an older version (SS 7, SS 2000, SS2005, SS 2008)
Consider downloading the SQL Server 2012 Express edition
Downloads for IBM i Access for Windows
http://www.web400.com/downloads/Verify_IBMiAccess_V5Rx_v2.pdf
http://www.web400.com/downloads/Verify_IBMiAccess_V7Rx.pdf
Configure IBMDA400 or IBMDASQL OLE DB providerTest OPENROWSET queryCreate/test linked server
36