2015, (Andy.PT) 1
""
1. Requirements For this session you will need a computer with: Windows 7 Professional or higher Office 2007 Professional or higher (Outlook and Access installed) Some of the drivers listed in these slides You will also need to know what means... SELECT * FROM SQLPort.Sessions WHERE SessionDate = '2015-02-24' (But if you don't you'll probably be fine I'll wake you up at the end of the session)
2. Why SQL? Why not? It's simple Easy to learn Everybody uses it! No need for complex scripting Most data tools support SQL Choose the tool you prefer: o MS Access o Visual Studio o MS SQL Server Import and Export o Any tool that supports ODBC or JDBC o... Anything that can be converted to tabular can be queried with SQL. Is your life's information tabular?
3. Excel Pros: You can import/link tabular data from external sources You don't need to know SQL or be a developer to use it Good for looking around Cons: Where's the nice SQL? No enforcing of data types
4. Microsoft Access Pros: Unlimited data sources: Multiple DBMS drivers, ODBC drivers, Outlook Text files (CSV, TAB, XML, HTML, etc.) Sharepoint, data services, etc. You can make your own driver! Imported/linked data organized as tables Data transformation using SQL, VBA, COM and.net libraries. Good for data migration across multiple data sources Good for backing up tables Querying multiple sources on a single SQL query Pass-through queries (single external source only) You don't need to know SQL or be a developer to use it Cons: 2 GiB data limit (workaround: multiple linked files) Maximum 10 fields on a primary key or index https://support.office.com/en-us/article/access-2010-specifications-1e521481-7f9a-46f7-8ed9-ea9dff1fa854
4. Microsoft Access (cont.)
5. SQL Querying Microsoft Outlook Typical Outlook information: Contact items: First name, last name Company, department, job Phone numbers, e-mail and business addresses Calendar items: Appointment information and location Start and end date Reminder time Mail items: From, To and CC (also BCC for your sent items) Date received/sent Subject Body You can add your own fields but they're not available this way.
5. SQL Querying Microsoft Outlook Demo (1)
5. SQL Querying Microsoft Outlook Demo (2)
5. SQL Querying Microsoft Outlook Demo (3) For this demo, we'll choose Contacts (try it with a mail or calendar folder as well)
5. SQL Querying Microsoft Outlook Demo (4)
5. SQL Querying Microsoft Outlook Demo (5) You can use the Query Designer to create queries with the linked tables. (How to make queries is not a part of this presentation)
6. ODBC Why? ODBC implementations exists for most data sources De facto standard Cross-platform (Windows, Linux, OS X) JDBC is similar Depending on the data source driver, not all functions may be implemented (e.g. no INSERT/UPDATE/DELETE, just SELECT) How? Create a data source name (DSN) Beware of 32bit and 64bit drivers (use the client's architecture)
6. ODBC Drivers (1) Microsoft SQL Server: Included in Windows (Pro versions). Native (non-odbc) driver widely supported and preferred MySQL: http://dev.mysql.com/downloads/connector/odbc/ Multi OS: http://dev.mysql.com/doc/connector-odbc/en/connector-odbcinstallation.html MariaDB: https://downloads.mariadb.org/connector-odbc/ IBM DB2 https://www-304.ibm.com/support/docview.wss?uid=swg21418043
6. ODBC Drivers (2) PostgreSQL: http://www.postgresql.org/ftp/odbc/versions/ Oracle: http://www.oracle.com/technetwork/database/windows/downloads/inde x-096177.html And some really old school stuff... DEC OBDC: Was used to access databases on VAX/VMS Write commands were kind of buggy http://odl.sysworks.biz/disk$vaxdocdec951/decw$book/dymfaa49.p272.d ecw$book
7. WMI ODBC Driver WMI is Microsoft's implementation of the Web-Based Enterprise Management (WBEM). Includes most metrics from Windows and Microsoft products. Warning: Use WMI ODBC for reading only. Writing may damage your system. Documentation: A few WMI Providers: https://msdn.microsoft.com/en-us/library/aa394570(v=vs.85).aspx Listing of OS classes: https://msdn.microsoft.com/en-us/library/dn792258%28v=vs.85%29.aspx Using the WMI ODBC Adapter with Access: https://msdn.microsoft.com/en-us/library/aa393959(v=vs.85).aspx Architecture intro: http://www.codeproject.com/articles/54064/working- With-Windows-Management-Instrumentation-WM
7. WMI ODBC Driver (cont.) Using WMI via scripting: https://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx WMI Browsing tools: https://technet.microsoft.com/en-us/library/cc181099.aspx C:\Windows\System32\WBEM\WBEMTest.EXE (typical path) Download (availability rare, download from this mirror): ftp://ftp.umh.es/parches/wxp/sp2/english/valueadd/msft/mgmt/wbe MODBC/README.HTM
7. WMI ODBC Driver examples Examples of WMI classes (all from "\\<Computer_Name>\root\cimv2"): Win32_Process Win32_PhysicalMemory Win32_StartupCommand Win32_Directory Win32_SubDirectory Win32_DiskDrive Win32_Volume Win32_UserAccount Win32_SystemAccount Win32_Group Win32_UTCTime Win32_Timezone Win32_Product
8. Other OS information OSQuery (Linux and OS X): https://github.com/facebook/osquery http://osquery.io/ Querying the registry within SQL Server: http://geekswithblogs.net/kazimmehdi/archive/2011/09/08/reading-registryvalue-using-t-sql.aspx http://www.codeguru.com/cpp/data/mfc_database/sqlserver/article.php/c7467/a ccessing-the-registry-from-sql-server.htm Querying Active Directory within SQL Server: http://www.databasejournal.com/features/mssql/article.php/3849891/query- Active-Directory-Data-from-SQL-Server-using-T-SQL.htm Querying Active Directory with ODBC: http://www.rssbus.com/odbc/ldap/
9. Twitter Twitter API now requires app ID / token (not good for consuming information). Twitter API explorer: https://dev.twitter.com/rest/tools/console Twitter widgets (embed) creation: https://twitter.com/settings/widgets Get data via RSS / XML using 3rd party services: https://twitrss.me/ https://twitrss.me/twitter_user_to_rss/?user=andypt&replies=on Query the XML data!
10. Facebook Facebook API / Graph explorer: https://developers.facebook.com/tools/explorer Facebook allows open RSS feeds for pages: Page: https://www.facebook.com/sqlport Get ID: https://graph.facebook.com/sqlport Use it: https://www.facebook.com/feeds/page.php?format=rss20&id=116112078418619 You can also get your own notifications via RSS feed: Go to https://www.facebook.com/notifications and select RSS on the top left. https://www.facebook.com/feeds/notifications.php?id=<my ID>&viewer=<Some ID>&key=<Some Token>&format=rss20 Facebook API also requires app ID / token for normal profiles. Use 3rd party again: http://fbrss.com Query the XML data!
"" SQLPort, 2015-02-24 http://andy.pt Andy@Andy.COM.PT https://linkedin.com/in/andremelancia https://facebook.com/andy.com.pt https://twitter.com/andypt