com.ibm.as400.access.jdbcClient

Class Main

  • java.lang.Object
    • com.ibm.as400.access.jdbcClient.Main
  • All Implemented Interfaces:
    java.lang.Runnable


    public class Main
    extends java.lang.Object
    implements java.lang.Runnable
    Main class for the jdbcClient program. This sample client uses JDBC to connect to the specified URL using the specified userid and password. This program is provided AS/IS and formal support will NOT be provided. This program should not be used in a production environment. Because this program is provided AS/IS, no consideration is made for NLS support.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String[] commandHelp 
      static java.lang.String[] knownDrivers 
      static java.lang.String promptString 
      static java.lang.String usage 
    • Constructor Summary

      Constructors 
      Constructor and Description
      Main(Main originalMain, java.lang.String command, java.io.PrintStream out) 
      Main(java.lang.String url, java.lang.String userid, java.lang.String password) 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static void appendMixedUXOutput(java.lang.StringBuffer sb, char[] chars) 
      static void dispResultSet(java.sql.ResultSet rs) 
      void executeCallCommand(java.lang.String command, java.io.PrintStream out1) 
      void executeCLCommand(java.lang.String clCommand, java.io.PrintStream out1) 
      boolean executeCommand(java.lang.String command1, java.io.PrintStream printStreamForExecuteCommand)
      Executes a command that is not an SQL query.
      void executeSqlCommand(java.lang.String command, java.io.PrintStream out1) 
      boolean executeTopLevelCommand(java.lang.String command, java.io.PrintStream printStreamForTopLevelCommand)
      Execute a top level command.
      java.lang.Object getParameterObject(java.lang.String thisParm, java.io.PrintStream printStreamForParameterObject) 
      java.sql.Connection getPooledConnection(java.lang.String thisConnectUserId, java.lang.String thisConnectPassword, java.lang.String connectUrl, java.io.PrintStream out1) 
      int go(java.io.InputStream in, java.io.PrintStream printStreamForGo) 
      static void main(java.lang.String[] args) 
      java.sql.Array makeArray(java.lang.Object parameter, java.lang.String arrayType) 
      static void printStackTraceToStringBuffer(java.lang.Throwable e, java.lang.StringBuffer sb) 
      void processException(java.sql.SQLException ex, java.lang.String command, java.io.PrintStream out1) 
      static java.lang.String readLine(java.io.BufferedReader input) 
      java.lang.String removeProperty(java.lang.String url, java.lang.String newProperties) 
      void run() 
      void setCommand(java.lang.String command) 
      void setManualResultSetColType(java.sql.ResultSetMetaData rsmd) 
      void setParameter(java.sql.PreparedStatement cstmt, java.lang.String thisParm, int parm, java.io.PrintStream printStreamForSetParameter) 
      void setPassword(java.lang.String newpassword) 
      void setUrl(java.lang.String newUrl) 
      void setUserId(java.lang.String newUserId) 
      void showMixedUXOutput(java.io.PrintStream out1, char[] chars) 
      void useConnectionPool(boolean value) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • knownDrivers

        public static java.lang.String[] knownDrivers
      • promptString

        public static java.lang.String promptString
      • usage

        public static java.lang.String usage
      • commandHelp

        public static java.lang.String[] commandHelp
    • Constructor Detail

      • Main

        public Main(java.lang.String url,
            java.lang.String userid,
            java.lang.String password)
             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • Main

        public Main(Main originalMain,
            java.lang.String command,
            java.io.PrintStream out)
    >
    • Method Detail

      • readLine

        public static java.lang.String readLine(java.io.BufferedReader input)
                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • go

        public int go(java.io.InputStream in,
             java.io.PrintStream printStreamForGo)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • setCommand

        public void setCommand(java.lang.String command)
      • useConnectionPool

        public void useConnectionPool(boolean value)
      • setUrl

        public void setUrl(java.lang.String newUrl)
      • setUserId

        public void setUserId(java.lang.String newUserId)
      • setPassword

        public void setPassword(java.lang.String newpassword)
      • removeProperty

        public java.lang.String removeProperty(java.lang.String url,
                                      java.lang.String newProperties)
      • setManualResultSetColType

        public void setManualResultSetColType(java.sql.ResultSetMetaData rsmd)
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getPooledConnection

        public java.sql.Connection getPooledConnection(java.lang.String thisConnectUserId,
                                              java.lang.String thisConnectPassword,
                                              java.lang.String connectUrl,
                                              java.io.PrintStream out1)
                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeCLCommand

        public void executeCLCommand(java.lang.String clCommand,
                            java.io.PrintStream out1)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • executeCallCommand

        public void executeCallCommand(java.lang.String command,
                              java.io.PrintStream out1)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • executeSqlCommand

        public void executeSqlCommand(java.lang.String command,
                             java.io.PrintStream out1)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • processException

        public void processException(java.sql.SQLException ex,
                            java.lang.String command,
                            java.io.PrintStream out1)
      • executeTopLevelCommand

        public boolean executeTopLevelCommand(java.lang.String command,
                                     java.io.PrintStream printStreamForTopLevelCommand)
        Execute a top level command. This may be an SQL statement or a command !
        Parameters:
        command -
        printStreamForTopLevelCommand -
        Returns:
        false if the top level command is exit or quit
      • executeCommand

        public boolean executeCommand(java.lang.String command1,
                             java.io.PrintStream printStreamForExecuteCommand)
        Executes a command that is not an SQL query. The ! has already been stripped from the command.
        Parameters:
        command1 -
        printStreamForExecuteCommand -
        Returns:
        false if the command is exit or quit
      • printStackTraceToStringBuffer

        public static void printStackTraceToStringBuffer(java.lang.Throwable e,
                                         java.lang.StringBuffer sb)
      • dispResultSet

        public static void dispResultSet(java.sql.ResultSet rs)
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • showMixedUXOutput

        public void showMixedUXOutput(java.io.PrintStream out1,
                             char[] chars)
      • appendMixedUXOutput

        public static void appendMixedUXOutput(java.lang.StringBuffer sb,
                               char[] chars)
      • getParameterObject

        public java.lang.Object getParameterObject(java.lang.String thisParm,
                                          java.io.PrintStream printStreamForParameterObject)
      • setParameter

        public void setParameter(java.sql.PreparedStatement cstmt,
                        java.lang.String thisParm,
                        int parm,
                        java.io.PrintStream printStreamForSetParameter)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • makeArray

        public java.sql.Array makeArray(java.lang.Object parameter,
                               java.lang.String arrayType)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • main

        public static void main(java.lang.String[] args)