com.ibm.db2os390.ive.st.data
Class DB2VisualExplainSqlTuningFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--com.ibm.db2os390.ive.st.data.DB2VisualExplainSqlTuningFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class DB2VisualExplainSqlTuningFrame
extends javax.swing.JFrame

DB2VisualExplainSqlTuningFrame is a class to provide an external API which used by Visual Explain for DB2/zOS.
This API can be used to construct an SQL tuning window.

showSqlTuningFrame:
This API constructs an SQL tuning window with given SQL statement , sqlid and queryno


The following environment variables must be set to run this API. db2jcc.jar and db2cc.jar are specific to DB2 UDB V8 and are not required for DB2 UDB V7:

SET JAVA_BIN=%IVE_DIR%\_jvm\bin
SET CLASSPATH=.;%IVE_DIR%;%DB2TEMPDIR%java\common.jar
SET CLASSPATH=%CLASSPATH%;%DB2TEMPDIR%java\db2java.zip;%DB2TEMPDIR%java\db2jcc.jar;%DB2TEMPDIR%TOOLS\db2cc.jar;%DB2TEMPDIR%java\Common.jar;
SET CLASSPATH=%classpath%;%IVE_DIR%\msgs\en_US;%IVE_DIR%\lib\xercesImpl.jar;%IVE_DIR%\lib\xml-apis.jar;%IVE_DIR%\lib\Common.jar;%IVE_DIR%\jar\ivebase.jar;%IVE_DIR%\jar\gf.jar;%IVE_DIR%\jar\da.jar;%IVE_DIR%\jar\plugindata.jar;%IVE_DIR%\jar\pluginapi.jar;%IVE_DIR%\jar\sa.jar;%IVE_DIR%\jar\stcommon.jar;%IVE_DIR%\jar\stdata.jar;%IVE_DIR%\jar\stapi.jar;%IVE_DIR%\jar\report.jar;%IVE_DIR%\jar\pluginapi.jar;%IVE_DIR%\jar\plugindata.jar;%IVE_DIR%\jar\filter.jar;%IVE_DIR%\jar\ftp.jar;%IVE_DIR%\jar\pli8.jar;
SET PATH=%JAVA_BIN%;%DB2TEMPDIR%bin;%IVE_DIR%\lib;%PATH%


A sample program utilizing this API, the plan name and DBRM name are V7 (char(8)).:

  
 import com.ibm.db2os390.ive.st.data.DB2VisualExplainSqlTuningFrame;
 import com.ibm.db2os390.ive.da.DVNDADB2Access;
 import java.io.*;
 import java.sql.*;
 import java.awt.event.*;

 class TestVEAPI{

  
	public static void main(String args[]) throws Exception{
	   	String dbname = "DBNAME";
    	String userid = "ADMF001";
    	String passwd = "PASSWORD";
        final Connection con = DVNDADB2Access.getConnection(dbname,dbname,"STLEC1","446",userid,passwd);

		DB2VisualExplainSqlTuningFrame veAPI = new DB2VisualExplainSqlTuningFrame(dbname,con,"C:\\Program Files\\Visual Explain");
        veAPI.addWindowListener(new WindowAdapter()
        {
            public void windowClosing(WindowEvent e)
            {
            	try{
					con.close();
					System.exit(0);

				}catch (SQLException ex){System.out.println("Connection unable to close");}
            }
        }
        );		
		veAPI.showStaticSqlTuningFrame("PGM1    ","PGM1    ", new Integer(153));
		System.out.println(veAPI.getStatusMsg());
		System.out.println(veAPI.getStatus());
	}

 } 

See Also:
Serialized Form

Field Summary
static int CONNECTION_CLOSED
          Integer value for the MSGS value of "Connection closed"
static int DB2_VERSION
          Integer value for the MSGS value of "DB2 is not V7 or V8"
static int INCORRECT_PARAM
          Integer value for the MSGS value of "Incorrect parameter"
static java.lang.String[] MSGS
          String values for the status code, possible values:
Success
Statement not found or statement not explainable
XML load error
XML delete error
Incorrect parameter
Subsystem not found:
No connection exists
Connection closed
DB2 is not V7 or V8
Unexpected error
static int NO_CONNECTION
          Integer value for the MSGS value of "No connection exists"
static int NOT_FOUND_RECORD
          Integer value for the MSGS value of "Statement not found or statement not explainable"
static int SUBSYS_NOT_FOUND
          Integer value for the MSGS value of "Subsystem not found: "
static int SUCCESS
          Integer value for the MSGS value of "Success"
static int UNEXPECTED
          Integer value for the MSGS value of "Unexpected error"
static int XML_ERROR_DELETE
          Integer value for the MSGS value of "XML delete error"
static int XML_ERROR_LOAD
          Integer value for the MSGS value of "XML load error"
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DB2VisualExplainSqlTuningFrame(java.lang.String subsystemAlias, java.sql.Connection con, java.lang.String baseDirectory)
          Constructor , constructs the top level window for SQL tuning window
 
Method Summary
 void closeFrame()
          Closes the Visual Explain main window it will do the saving setting and clean up under the cover
 int getStatus()
          Returns the status code of this class as an integer.
 java.lang.String getStatusMsg()
          Returns the status code of this class as a string.
 void showSqlTuningFrame(java.lang.Integer queryno, java.lang.String sqlid, java.lang.String sqlStatement)
          Creates the tuning SQL window for a dynamic SQL statement.
 boolean showStaticSqlTuningFrame(java.lang.String name, java.lang.String plname, java.lang.Integer stmtno)
          Creates the tuning SQL window for a statement and its access plan in a plan (static SQL, from SYSIBM.SYSSTMT)
If the statement exists and its access path does not exist, the tuning SQL window is loaded without
an access plan.
 boolean showStaticSqlTuningFrame(java.lang.String collid, java.lang.String name, java.lang.String contoken, java.lang.Integer stmtno)
          Creates the tuning SQL window for a statement and its access plan in a package (static SQL, from SYSIBM.SYSPACKSTMT) If the statement exists and its access path does not exist, the tuning SQL window is loaded without
an access plan.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

SUCCESS

public static final int SUCCESS
Integer value for the MSGS value of "Success"

See Also:
Constant Field Values

NOT_FOUND_RECORD

public static final int NOT_FOUND_RECORD
Integer value for the MSGS value of "Statement not found or statement not explainable"

See Also:
Constant Field Values

XML_ERROR_LOAD

public static final int XML_ERROR_LOAD
Integer value for the MSGS value of "XML load error"

See Also:
Constant Field Values

XML_ERROR_DELETE

public static final int XML_ERROR_DELETE
Integer value for the MSGS value of "XML delete error"

See Also:
Constant Field Values

INCORRECT_PARAM

public static final int INCORRECT_PARAM
Integer value for the MSGS value of "Incorrect parameter"

See Also:
Constant Field Values

SUBSYS_NOT_FOUND

public static final int SUBSYS_NOT_FOUND
Integer value for the MSGS value of "Subsystem not found: "

See Also:
Constant Field Values

NO_CONNECTION

public static final int NO_CONNECTION
Integer value for the MSGS value of "No connection exists"

See Also:
Constant Field Values

CONNECTION_CLOSED

public static final int CONNECTION_CLOSED
Integer value for the MSGS value of "Connection closed"

See Also:
Constant Field Values

DB2_VERSION

public static final int DB2_VERSION
Integer value for the MSGS value of "DB2 is not V7 or V8"

See Also:
Constant Field Values

UNEXPECTED

public static final int UNEXPECTED
Integer value for the MSGS value of "Unexpected error"

See Also:
Constant Field Values

MSGS

public static final java.lang.String[] MSGS
String values for the status code, possible values:
Success
Statement not found or statement not explainable
XML load error
XML delete error
Incorrect parameter
Subsystem not found:
No connection exists
Connection closed
DB2 is not V7 or V8
Unexpected error

Constructor Detail

DB2VisualExplainSqlTuningFrame

public DB2VisualExplainSqlTuningFrame(java.lang.String subsystemAlias,
                                      java.sql.Connection con,
                                      java.lang.String baseDirectory)
Constructor , constructs the top level window for SQL tuning window

Parameters:
subsystemAlias - alias of subsystem
con - the connection passed in
baseDirectory - the base directory that Visual Explain is located in, usually C:\Program Files\Visual Explain
Method Detail

showSqlTuningFrame

public void showSqlTuningFrame(java.lang.Integer queryno,
                               java.lang.String sqlid,
                               java.lang.String sqlStatement)
Creates the tuning SQL window for a dynamic SQL statement.

Parameters:
queryno - queryno of the query needs to be explained
sqlid - the schema name in which the user intends to explain the statement
sqlStatement - the SQL statement that will be explained

showStaticSqlTuningFrame

public boolean showStaticSqlTuningFrame(java.lang.String name,
                                        java.lang.String plname,
                                        java.lang.Integer stmtno)
Creates the tuning SQL window for a statement and its access plan in a plan (static SQL, from SYSIBM.SYSSTMT)
If the statement exists and its access path does not exist, the tuning SQL window is loaded without
an access plan.

Parameters:
name - - the DBRM name
plname - - the plan name
stmtno - - the statement number
Returns:
true - successful; false - failure

showStaticSqlTuningFrame

public boolean showStaticSqlTuningFrame(java.lang.String collid,
                                        java.lang.String name,
                                        java.lang.String contoken,
                                        java.lang.Integer stmtno)
Creates the tuning SQL window for a statement and its access plan in a package (static SQL, from SYSIBM.SYSPACKSTMT) If the statement exists and its access path does not exist, the tuning SQL window is loaded without
an access plan.

Parameters:
collid - - the collection ID
name - - the package name
contoken - - the consistency token
stmtno - - the statement number
Returns:
true - successful; false - failure

getStatus

public int getStatus()
Returns the status code of this class as an integer.

Returns:
integer value of the status

getStatusMsg

public java.lang.String getStatusMsg()
Returns the status code of this class as a string.

Returns:
string value of the status

closeFrame

public void closeFrame()
Closes the Visual Explain main window it will do the saving setting and clean up under the cover