Java Doc for util.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » tools » ij » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.tools.ij 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.tools.ij.util

util
final public class util implements java.security.PrivilegedAction(Code)
Methods used to control setup for apps as well as display some internal ij structures.
See Also:   org.apache.derby.tools.JDBCDisplayUtil
author:
   ames




Method Summary
public static  voidDisplayMulti(LocalizedOutput out, PreparedStatement ps, ResultSet rs, Connection conn)
     Display a statement that takes parameters by stuffing it with rows from the result set and displaying each result each time through.
public static  voidDisplayVector(LocalizedOutput out, Vector v)
     Display a vector of strings to the out stream.
static  voidUsage(LocalizedOutput out)
     print a usage message for invocations of main().
public static  StringgetArg(String param, String[] args)
     Find the argument that follows the specified parameter.
Parameters:
  param - the parameter (e.g.
public static  PropertiesgetConnAttributeArg(String[] args)
     ij is started with "-ca[r] file OtherArgs"; the file contains connection attibute properties to pass to getConnection

getConnAttributeArg will look at the args and take out a "-ca[r] " pair and returning the Properties


exception:
  IOException - thrown if file not found
Parameters:
  args - the argument list to consider.

public static  ConnectiongetDataSourceConnection(String dsName, String user, String password, String dbName, boolean firstTime)
     Returns a connection obtained using the DataSource.
public static  StringgetFileArg(String[] args)
     Return the name of the ij command file or null if none is specified.
public static  StringgetInputResourceNameArg(String[] args)
     Return the name of a resource containing input commands or null iff none has been specified.
public static  booleangetPropertyArg(String[] args)
     ij is started with "-p[r] file OtherArgs"; the file contains properties to control the driver and database used to run ij, and can provide additional system properties.

getPropertyArg will look at the args and take out a "-p " pair, reading the file into the system properties.

If there was a -p without a following , no action is taken.
exception:
  IOException - thrown if file not found
Parameters:
  args - the argument list to consider.

public static  InputStreamgetResourceAsStream(String resourceName)
     Convenience routine to get a resource as a BufferedInputStream.
public static  StringgetSelectedSchema(Connection theConnection)
     Selects the current schema from the given connection.
final static  StringgetSystemProperty(String propertyName)
    
public static  booleaninvalidArgs(String[] args)
     Verify the ij line arguments command arguments.
public static  voidloadDriver(String driverClass)
     Load a driver given a class name.
public static  voidloadDriverIfKnown(String jdbcProtocol)
     Find the appropriate driver and load it, given a JDBC URL.
static  StringqualifyResourceName(String resourceName, boolean absolute)
     Convenience routine to qualify a resource name with "ij.defaultPackageName" if it is not qualified (does not begin with a "/").
Parameters:
  absolute - true means return null if the name is not absolute and falsemeans return partial names.
final public  Objectrun()
    
public static  voidsetupDataSource(Object ds, String dbName, boolean firstTime)
     Sets up a data source with values specified in ij.dataSource.* properties or passed as parameters of this method
Parameters:
  ds - DataSource object
Parameters:
  dbName - Database Name
Parameters:
  firstTime - If firstTime is false, ij.dataSource.createDatabase and ij.dataSource.databaseName properties will not be used.
public static  ConnectionstartJBMS(String defaultDriver, String defaultURL, Properties connInfo)
     This will look for the System properties "ij.driver" and "ij.database" and return a java.sql.Connection if it successfully connects.
public static  ConnectionstartJBMS()
     Utility interface that defaults driver and database to null.
public static  ConnectionstartJBMS(String defaultDriver, String defaultURL)
    
public static  PropertiesupdateConnInfo(String user, String password, Properties connInfo)
    



Method Detail
DisplayMulti
public static void DisplayMulti(LocalizedOutput out, PreparedStatement ps, ResultSet rs, Connection conn) throws SQLException, ijException(Code)
Display a statement that takes parameters by stuffing it with rows from the result set and displaying each result each time through. Deal with autocommit behavior along the way.
exception:
  SQLException - thrown on db error
exception:
  ijException - thrown on ij error



DisplayVector
public static void DisplayVector(LocalizedOutput out, Vector v)(Code)
Display a vector of strings to the out stream.



Usage
static void Usage(LocalizedOutput out)(Code)
print a usage message for invocations of main().



getArg
public static String getArg(String param, String[] args)(Code)
Find the argument that follows the specified parameter.
Parameters:
  param - the parameter (e.g. "-p")
Parameters:
  args - the argument list to consider. the argument that follows the parameter, or null if not found



getConnAttributeArg
public static Properties getConnAttributeArg(String[] args) throws IOException(Code)
ij is started with "-ca[r] file OtherArgs"; the file contains connection attibute properties to pass to getConnection

getConnAttributeArg will look at the args and take out a "-ca[r] " pair and returning the Properties


exception:
  IOException - thrown if file not found
Parameters:
  args - the argument list to consider. properties in the file




getDataSourceConnection
public static Connection getDataSourceConnection(String dsName, String user, String password, String dbName, boolean firstTime) throws SQLException(Code)
Returns a connection obtained using the DataSource. This method will be called when ij.dataSource property is set. It uses ij.dataSource.* properties to get details for the connection.
Parameters:
  dsName - Data Source name
Parameters:
  user - User name
Parameters:
  password - Password
Parameters:
  dbName - Database Name
Parameters:
  firstTime - Indicates if the method is called first time. This is passed to setupDataSource method.
throws:
  SQLException -



getFileArg
public static String getFileArg(String[] args) throws IOException(Code)
Return the name of the ij command file or null if none is specified. The command file may be proceeded with -f flag on the command line. Alternatively, the command file may be specified without a -f flag. In this case we assume the first unknown argument is the command file.

This should only be called after calling invalidArgs.

If there is no such argument, a null is returned.
Parameters:
  args - the argument list to consider. the name of the first argument not preceded by "-p",null if none found.
exception:
  IOException - thrown if file not found




getInputResourceNameArg
public static String getInputResourceNameArg(String[] args)(Code)
Return the name of a resource containing input commands or null iff none has been specified.



getPropertyArg
public static boolean getPropertyArg(String[] args) throws IOException(Code)
ij is started with "-p[r] file OtherArgs"; the file contains properties to control the driver and database used to run ij, and can provide additional system properties.

getPropertyArg will look at the args and take out a "-p " pair, reading the file into the system properties.

If there was a -p without a following , no action is taken.
exception:
  IOException - thrown if file not found
Parameters:
  args - the argument list to consider. true if a property item was found and loaded.




getResourceAsStream
public static InputStream getResourceAsStream(String resourceName)(Code)
Convenience routine to get a resource as a BufferedInputStream. If the resourceName is not absolute (does not begin with a "/") this qualifies the name with the "ij.defaultResourcePackage" name.
Parameters:
  resourceName - the name of the resource a buffered stream for the resource if it exists and null otherwise.



getSelectedSchema
public static String getSelectedSchema(Connection theConnection) throws SQLException(Code)
Selects the current schema from the given connection. As there are no way of getting current schema supported by all major DBMS-es, this method may return null.
Parameters:
  theConnection - Connection to get current schema for the current schema of the connection, or null if error.



getSystemProperty
final static String getSystemProperty(String propertyName)(Code)



invalidArgs
public static boolean invalidArgs(String[] args)(Code)
Verify the ij line arguments command arguments. Also used to detect --help. true if the args are invalid
  • Only legal argument provided.
  • Only specify a quantity once.



loadDriver
public static void loadDriver(String driverClass) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Load a driver given a class name.
exception:
  ClassNotFoundException - if unable tolocate class for driver.
exception:
  InstantiationException - if unable tocreate an instance.
exception:
  IllegalAccessException - if driver class constructor not visible.



loadDriverIfKnown
public static void loadDriverIfKnown(String jdbcProtocol) throws ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Find the appropriate driver and load it, given a JDBC URL. No action if no driver known for a given URL.
Parameters:
  jdbcProtocol - the protocol to try.
exception:
  ClassNotFoundException - if unable tolocate class for driver.
exception:
  InstantiationException - if unable tocreate an instance.
exception:
  IllegalAccessException - if driver class constructor not visible.



qualifyResourceName
static String qualifyResourceName(String resourceName, boolean absolute)(Code)
Convenience routine to qualify a resource name with "ij.defaultPackageName" if it is not qualified (does not begin with a "/").
Parameters:
  absolute - true means return null if the name is not absolute and falsemeans return partial names.



run
final public Object run()(Code)



setupDataSource
public static void setupDataSource(Object ds, String dbName, boolean firstTime) throws Exception(Code)
Sets up a data source with values specified in ij.dataSource.* properties or passed as parameters of this method
Parameters:
  ds - DataSource object
Parameters:
  dbName - Database Name
Parameters:
  firstTime - If firstTime is false, ij.dataSource.createDatabase and ij.dataSource.databaseName properties will not be used. The value in parameter dbName will be used instead of ij.dataSource.databaseName.
throws:
  Exception -



startJBMS
public static Connection startJBMS(String defaultDriver, String defaultURL, Properties connInfo) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
This will look for the System properties "ij.driver" and "ij.database" and return a java.sql.Connection if it successfully connects. The deprecated driver and database properties are examined first.

If no connection was possible, it will return a null.

Failure to load the driver class is quietly ignored.
Parameters:
  defaultDriver - the driver to use if no property value found
Parameters:
  defaultURL - the database URL to use if no property value found
Parameters:
  connInfo - Connection attributes to pass to getConnection a connection to the defaultURL if possible; null if not.
exception:
  SQLException - on failure to connect.
exception:
  ClassNotFoundException - on failure to load driver.
exception:
  InstantiationException - on failure to load driver.
exception:
  IllegalAccessException - on failure to load driver.




startJBMS
public static Connection startJBMS() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Utility interface that defaults driver and database to null. a connection to the defaultURL if possible; null if not.
exception:
  SQLException - on failure to connect.
exception:
  ClassNotFoundException - on failure to load driver.
exception:
  InstantiationException - on failure to load driver.
exception:
  IllegalAccessException - on failure to load driver.



startJBMS
public static Connection startJBMS(String defaultDriver, String defaultURL) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException(Code)
Utility interface that defaults connInfo to null


Parameters:
  defaultDriver - the driver to use if no property value found
Parameters:
  defaultURL - the database URL to use if no property value found a connection to the defaultURL if possible; null if not.
exception:
  SQLException - on failure to connect.
exception:
  ClassNotFoundException - on failure to load driver.
exception:
  InstantiationException - on failure to load driver.
exception:
  IllegalAccessException - on failure to load driver.




updateConnInfo
public static Properties updateConnInfo(String user, String password, Properties connInfo)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.