Java Doc for DAOUtils.java in  » J2EE » panther » org » lateralnz » common » util » 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 » J2EE » panther » org.lateralnz.common.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.lateralnz.common.util.DAOUtils

DAOUtils
public class DAOUtils implements Constants(Code)
utility functions for use with Data Access Objects and for more general JDBC stuff
author:
   J R Briggs




Method Summary
final public static  StringbuildSQL(ResourceBundle sqlstatements, String[] keys)
    
public static  booleanclose(Statement st)
    
public static  booleanclose(ResultSet rs)
    
public static  booleanclose(Connection conn)
    
public static  booleancommit(Connection conn)
    
final public static  StringcreateParameterPlaceholders(int count)
    
final public static  StringcreateSQLArrayString(String[] vals, int start, int len)
    
public static  Stringdump(ResultSet rs)
    
public static  StringdumpData(ResultSet rs)
    
public static  booleangetCharAsBoolean(ResultSet rs, String column, boolean defaultValue)
     get a char(1) as a boolean value.
public static  ColumnMetaDatagetColumnMetaData(Connection conn, String schema, String table, String column)
     return column meta data for a particular column using the specified connection.
public static  ConnectiongetConnection(String datasource)
    
public static  DategetDate(ResultSet rs, String columnName)
    
public static  booleanhasColumnMetaData(String schema, String table, String column)
     a method for checking if column meta data has been cached for the specified schema, table and column name.
public static  booleanisDuplicateKeyException(Throwable t)
    
public static  booleanisDuplicateKeyException(SQLException se)
    
final public static  StringparseInClause(String sql, int numInList)
    
final public static  voidregisterDriver(String driverClass)
    
public static  voidsetParam(PreparedStatement ps, int col, String value)
     set a String parameter on a prepared statement according to its index.
public static  voidsetParam(PreparedStatement ps, int col, int value)
     set an int parameter on a prepared statement according to its index. Note: if the value is less than 0, setNull will be called.
public static  voidsetParam(PreparedStatement ps, int col, int value, boolean preserve)
     set an int parameter on a prepared statement according to its index.
public static  voidsetParam(PreparedStatement ps, int col, float value)
     set a float parameter on a prepared statement according to its index.
public static  voidsetParam(PreparedStatement ps, int col, Date value)
     set a Date parameter on a prepared statement according to its index.
public static  voidsetParam(PreparedStatement ps, int col, boolean value)
    



Method Detail
buildSQL
final public static String buildSQL(ResourceBundle sqlstatements, String[] keys)(Code)



close
public static boolean close(Statement st)(Code)



close
public static boolean close(ResultSet rs)(Code)



close
public static boolean close(Connection conn)(Code)



commit
public static boolean commit(Connection conn)(Code)



createParameterPlaceholders
final public static String createParameterPlaceholders(int count)(Code)



createSQLArrayString
final public static String createSQLArrayString(String[] vals, int start, int len)(Code)



dump
public static String dump(ResultSet rs)(Code)



dumpData
public static String dumpData(ResultSet rs)(Code)



getCharAsBoolean
public static boolean getCharAsBoolean(ResultSet rs, String column, boolean defaultValue) throws SQLException(Code)
get a char(1) as a boolean value. e.g. Y = true, N = false, an empty char = defaultvalue



getColumnMetaData
public static ColumnMetaData getColumnMetaData(Connection conn, String schema, String table, String column) throws SQLException(Code)
return column meta data for a particular column using the specified connection. If the data is present in the cache, then the cached metadata is returned, otherwise the connection is used and the response is cached.



getConnection
public static Connection getConnection(String datasource) throws SQLException(Code)
get a connection from a named datasource using JNDI
Parameters:
  datasource - the name of the data source to retrieve



getDate
public static Date getDate(ResultSet rs, String columnName) throws SQLException(Code)
given a resultset and column name of a timestamp column, return the column as a java.util.Date



hasColumnMetaData
public static boolean hasColumnMetaData(String schema, String table, String column)(Code)
a method for checking if column meta data has been cached for the specified schema, table and column name. BEWARE: this method may need to change from database to database



isDuplicateKeyException
public static boolean isDuplicateKeyException(Throwable t)(Code)



isDuplicateKeyException
public static boolean isDuplicateKeyException(SQLException se)(Code)



parseInClause
final public static String parseInClause(String sql, int numInList)(Code)



registerDriver
final public static void registerDriver(String driverClass) throws Exception(Code)



setParam
public static void setParam(PreparedStatement ps, int col, String value) throws SQLException(Code)
set a String parameter on a prepared statement according to its index. Note: if the value is null, this will call setNull
Parameters:
  ps - the PreparedStatement
Parameters:
  col - the index of the parameter
Parameters:
  value - the string to set



setParam
public static void setParam(PreparedStatement ps, int col, int value) throws SQLException(Code)
set an int parameter on a prepared statement according to its index. Note: if the value is less than 0, setNull will be called. If you want to set a negative integer, then you must call setParam with preserveNegative set to true.
Parameters:
  ps - the PreparedStatement
Parameters:
  col - the index of the parameter
Parameters:
  value - the int value to set



setParam
public static void setParam(PreparedStatement ps, int col, int value, boolean preserve) throws SQLException(Code)
set an int parameter on a prepared statement according to its index. Note: if the value is less than 0, setNull will be called unless preserve is set to true
Parameters:
  ps - the PreparedStatement
Parameters:
  col - the index of the parameter
Parameters:
  value - the int value to set
Parameters:
  preserveNegative - do not call setNull if this is true



setParam
public static void setParam(PreparedStatement ps, int col, float value) throws SQLException(Code)
set a float parameter on a prepared statement according to its index. Note: if the value is Float.NEGATIVE_INFINITY, setNull will be called
Parameters:
  ps - the PreparedStatement
Parameters:
  col - the index of the parameter
Parameters:
  value - the float value to set
Parameters:
  preserveNegative - do not call setNull if this is true



setParam
public static void setParam(PreparedStatement ps, int col, Date value) throws SQLException(Code)
set a Date parameter on a prepared statement according to its index. Note: if the value is null, this will call setNull
Parameters:
  ps - the PreparedStatement
Parameters:
  col - the index of the parameter
Parameters:
  value - the date to set



setParam
public static void setParam(PreparedStatement ps, int col, boolean value) throws SQLException(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.