Weird Stuff I Saw While ... Supporting a Java Team

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

11-Jun-14 The assert statement. 2 About the assert statement The purpose of the assert statement is to give you a way to catch program errors early The.
1 - Oracle Server Architecture Overview
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
DB Audit Expert v1.1 for Oracle Copyright © SoftTree Technologies, Inc. This presentation is for DB Audit Expert for Oracle version 1.1 which.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
How a little code can help with support.. Chris Barba – Developer at Cimarex Energy Blog:
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 12 1 Microsoft Office Access 2003 Tutorial 12 – Managing and Securing a Database.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
Microsoft ® Office SharePoint ® Server 2007 Training Excel Services II: Requirements, recommendations, and permissions [Your company name] presents:
Effective Test Driven Database Development Gojko Adzic
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
JDBC Java and Databases. RHS – SOC 2 JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
Diagnostic Pathfinder for Instructors. Diagnostic Pathfinder Local File vs. Database Normal operations Expert operations Admin operations.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
SQL Server 2005 Engine Optimistic Concurrency Tony Rogerson, SQL Server MVP Independent Consultant 26 th.
An Introduction to Forms. The Major Steps of a MicroSoft Access Database  Tables  Queries  Forms  Macros  Reports  Modules On our road map, we are.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming –TextField Action Listeners, JEditorPane action listeners, HTML in a JEditorPane,
Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Function, Trigger used in PosgreSQL.
JDBC Java and Databases. SWC – JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Does the Optimistic Concurrency resolve your blocking problems Margarita Naumova, SQL Master Academy.
JDBC.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
Remote Procedure Calls
ASP.NET Programming with C# and SQL Server First Edition
Running a Forms Developer Application
Introduction to Python
Data Virtualization Tutorial… OAuth Example using Google Sheets
Weird Stuff I Saw While ... Supporting a Java Team
Addressing Pushback from Patients
Testing and Debugging.
Arrays and files BIS1523 – Lecture 15.
Microsoft® Word 2010 Training
Error Handling Summary of the next few pages: Error Handling Cursors.
Weird Stuff I Saw While ... Supporting a Java Team
Week 4 - Monday CS222.
SQL Server May Let You Do It, But it Doesn’t Mean You Should
Principles of report writing
ISC440: Web Programming 2 Server-side Scripting PHP 3
Tattling and Correcting Others
When I Use NOLOCK AND OTHER HINTS
Agenda Database Development – Best Practices Why Performance Matters ?
Why Should I Care About … Partitioned Views?
Interacting with Database
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Weird Stuff I Saw While ... Supporting a Java Team
Microsoft Office Access 2003
CSCE 489- Problem Solving Programming Strategies Spring 2018
When I Use NOLOCK AND OTHER HINTS
SQL Server Security 101 How did you get in here, and
Understanding Transaction Isolation Levels
Git CS Fall 2018.
Parameter Sniffing: the Good, the Bad, and the Ugly
Transaction Log Internals and Performance David M Maxwell
Parameter Sniffing: the Good,the Bad, and the Ugly
When I Use NOLOCK AND OTHER HINTS
Parameter Sniffing: the Good, the Bad, and the Ugly
CodePainter Revolution Trainer Course
Booksy University Bug Reports and Feature Requests.
A – Pre Join Indexes.
SQL Server Security 101 How did you get in here, and
Exceptions 10-May-19.
Vendor Software Lessons From Consulting Vendor Software.
Presentation transcript:

Weird Stuff I Saw While ... Supporting a Java Team Rick Lowe rick@data-flowe.com @dataflowe Rick’s Upcoming eLearning Courses Performance Monitoring – July 27 MSSQL on AWS – August 9 Code that Kills Performance – Sep 13

What I’m Not I am not a Java Expert I deny that I’m a developer Probably not especially knowledgeable about using MSSQL from Java … I am interested in starting a conversation about these issues 2 | 10/10/2015 Session Title Here

Day 1 : Lets tune their worst query 3 | 10/10/2015 Session Title Here

SelectMethod Options “SelectMethod = full” : client retrieves entire result set “SelectMethod = cursor” : server side cursor “responseBuffering=adaptive” : Results retrieved as they are needed Some are unaware of adaptive buffering. Adaptive buffering is default in JDBC 2.0 and later 4 | 10/10/2015 Session Title Here

Server Side Cursors Works much like a normal cursor Cursor is created from a query and opened Results are read back row-by-agonizing-row Every single one of these steps involves a trip across the network One row at a time minimizes memory requirements on the client 5 | 10/10/2015 Session Title Here

Removing server side cursors Not just annoying - potential performance issue In recent JDBC versions, simply remove “SelectMethod=cursor” from URL Evaluate on test system first Possible issue if code repeatedly accesses same row Workloads do exist where cursors are appropriate from a client side perspective 6 | 10/10/2015 Session Title Here

Day 8 : Conversion to CRUD 7 | 10/10/2015 Session Title Here

How things work in ADO.Net try { mySqlCommand.executeUpdate(); } catch …. executeUpdate() is not actually void, it returns # of rows impacted. … except we usually use NOCOUNT which means the return is always 0 And errors are more interesting than counts 8 | 10/10/2015 Session Title Here

How things work in Java PreparedStatement.executeUpdate() returns the number of rows impacted … and it often actually gets paid attention to When inserting, often check for return == 1 Quick fix is to remove “SET NOCOUNT ON” from Create stored procedures 9 | 10/10/2015 Session Title Here

Day 31 : OUTPUT parameters 10 | 10/10/2015 Session Title Here

It all seemed so easy… PreparedStatement.executeUpdate() will not allow you to simply ignore parameters PreparedStatement does not understand output parameters Must use PreparedCall instead To add confusion, there’s a new weird syntax you can use 11 | 10/10/2015 Session Title Here

Windows Authentication Doesn’t work. Just kidding, it works. It just doesn’t work by default. Setup depends on version 12 | 10/10/2015 Session Title Here

Prior to JDBC 4 Copy sqljdbc_auth.dll from <jdbc>\sqljdbc_version\<language>\auth\<arch> to windows\system32 Be sure to grab the correct architecture – x86 vs x64 Then integratedSecurity=SSPI will work as expected. Alternately, use the –Djava.library.path 13 | 10/10/2015 Session Title Here

Starting With JDBC 4 Can still use sqljdbc_auth Alternately, can use Java Kerberos authenticationScheme=JavaKerberos integratedSecurity=true Must now specify FQDN for server name 14 | 10/10/2015 Session Title Here

V1 Enterprise Java Beans Enterprise Java Beans help encapsulate DB code Developers implement methods to Create, Update, and Delete records Called automatically as code works with objects Issue with early versions – update method can be called whether or not data changes 15 | 10/10/2015 Session Title Here

The Talk 16 | 10/10/2015 Session Title Here

Query Hints In .Net shops, the NOLOCK wars rage on Abusing hints is a bad habit … … So we shouldn’t expect that getting folks to stop using NOLOCK just because we tell them the 101st time. We usually settle for making our personal sandbox a “no smoking zone” 17 | 10/10/2015 Session Title Here

Query Hints Contd. Java people typically aren’t stovepiped to the Microsoft stack This may be a new discussion for them Sometimes easier to change habits in this community 18 | 10/10/2015 Session Title Here

Stopping NOLOCK: What May Not Work 9 out of 10 DBAs agree : NOLOCK is bad If you don’t care about getting the correct answer, why are we using a database? Sure it works in test, but trust me – strange things could happen in prod. 19 | 10/10/2015 Session Title Here

What Might Work A dirty read doesn’t mean you get an old value. If a page is splitting it could be anything. What happens if we return the wrong person’s SSN? Have you heard about Read Committed Snapshot Isolation? If I could promise writers won’t block readers, can we stop using NOLOCK? 20 | 10/10/2015 Session Title Here