Java Doc for DBInterface.java in  » Database-Client » GUAM » guam » 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 Client » GUAM » guam 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   guam.DBInterface

DBInterface
public class DBInterface (Code)
Interface with the MySQL database to create connections, close connections and administer user data
author:
   dkc
version:
   1.0


Field Summary
final public static  intALL
    
final public static  intALTER
    
final public static  intCREATE
    
final public static  intDELETE
    
final public static  intDROP
    
final public static  intFILE
    
final public static  intGRANT
    
final public static  intINDEX
    
final public static  intINSERT
    
final public static  intPROCESS
    
final public static  intREFERENCES
    
final public static  intRELOAD
    
final public static  intSELECT
    
final public static  intSHUTDOWN
    
final public static  intUPDATE
    
final public static  intUSAGE
    
 longlastAccessed
    

Constructor Summary
public  DBInterface()
    

Method Summary
public  booleanchangeUserPass(String username, String password)
    
public  booleanconnect(String dbHost, String userName, String userPass, String dbPort)
    
public  booleancreateUser(String username, String password)
    
public  booleandeleteUser(String username)
     Delete a user from the database user list.
public  voiddisconnect()
     Disconnect from server.
public  VectorgetColumnPrivs(String username, String DBName, String TableName, String ColName)
    
public  VectorgetDBPrivs(String username, String DBName)
    
public  HashtablegetDBStructure()
     Returns the structure of the current database a Hashtable prepared for insertion into a JTree.
public  VectorgetGlobalPrivs(String username)
    
public  VectorgetTablePrivs(String username, String DBName, String TableName)
    
public  VectorgetUserList()
    
public  booleangrantColumnPriv(String username, String database, String table, String column, int privilege)
    
public  booleangrantColumnPriv(String username, String database, String table, String[] columns, int privilege)
    
public  booleangrantDBPriv(String username, String database, int privilege)
    
public  booleangrantGlobalPriv(String username, int privilege)
    
public  booleangrantTablePriv(String username, String database, String table, int privilege)
    
public  booleanisConnected()
     Check to see if there is a connection open.
public  booleanrevokeColumnPriv(String username, String database, String table, String column, int privilege)
    
public  booleanrevokeColumnPriv(String username, String database, String table, String[] columns, int privilege)
    
public  booleanrevokeDBPriv(String username, String database, int privilege)
    
public  booleanrevokeGlobalPriv(String username, int privilege)
    
public  booleanrevokeTablePriv(String username, String database, String table, int privilege)
    

Field Detail
ALL
final public static int ALL(Code)



ALTER
final public static int ALTER(Code)



CREATE
final public static int CREATE(Code)



DELETE
final public static int DELETE(Code)



DROP
final public static int DROP(Code)



FILE
final public static int FILE(Code)



GRANT
final public static int GRANT(Code)



INDEX
final public static int INDEX(Code)



INSERT
final public static int INSERT(Code)



PROCESS
final public static int PROCESS(Code)



REFERENCES
final public static int REFERENCES(Code)



RELOAD
final public static int RELOAD(Code)



SELECT
final public static int SELECT(Code)



SHUTDOWN
final public static int SHUTDOWN(Code)



UPDATE
final public static int UPDATE(Code)



USAGE
final public static int USAGE(Code)



lastAccessed
long lastAccessed(Code)




Constructor Detail
DBInterface
public DBInterface()(Code)
Construct the object, load the JDBC driver




Method Detail
changeUserPass
public boolean changeUserPass(String username, String password)(Code)
Change a user's password
Parameters:
  username - the user whose password is to be changed
Parameters:
  password - the new password for the user true if the change was successful, false if there was an error



connect
public boolean connect(String dbHost, String userName, String userPass, String dbPort)(Code)
Connect to a MySQL server
Parameters:
  dbHost - Hostname to connect to
Parameters:
  userName - User to log in as
Parameters:
  userPass - Password for given user or null if no password set
Parameters:
  dbPort - Port to connect or null for default true if the connection succeeded or false if there was a problem connecting



createUser
public boolean createUser(String username, String password)(Code)
Create a MySQL user on the server
Parameters:
  username - Username to create
Parameters:
  password - Password for user true if the user was created successfully, false if there was an error.



deleteUser
public boolean deleteUser(String username)(Code)
Delete a user from the database user list.
Parameters:
  username - The user to delete true if deletion was successful, false if there was an error



disconnect
public void disconnect()(Code)
Disconnect from server. If not connected, does nothing.



getColumnPrivs
public Vector getColumnPrivs(String username, String DBName, String TableName, String ColName)(Code)
Returns column privileges for a given user
Parameters:
  username - the name of the user whose privileges are to be returned
Parameters:
  DBName - The name of the database
Parameters:
  TableName - The name of the table
Parameters:
  ColName - the name of the column a Vector containing strings of all the privileges the user has



getDBPrivs
public Vector getDBPrivs(String username, String DBName)(Code)
Returns database privileges for a given user
Parameters:
  username - the name of the user whose privileges are to be returned
Parameters:
  DBName - The name of the database a Vector containing strings of all the privileges the user has



getDBStructure
public Hashtable getDBStructure()(Code)
Returns the structure of the current database a Hashtable prepared for insertion into a JTree. The structure is as follows:root->databases->tables->columns, where databases and tables are hashtables and columns is aVector. The keys in the hashtables are the name of the element, and the Vector elementsare Strings.



getGlobalPrivs
public Vector getGlobalPrivs(String username)(Code)
Returns the global privileges for a given user
Parameters:
  username - the name of the user whose privileges are to be returned a Vector containing strings of all the privileges the user has



getTablePrivs
public Vector getTablePrivs(String username, String DBName, String TableName)(Code)
Returns table privileges for a given user
Parameters:
  username - the name of the user whose privileges are to be returned
Parameters:
  DBName - The name of the database
Parameters:
  TableName - The name of the table a Vector containing strings of all the privileges the user has



getUserList
public Vector getUserList()(Code)
Retrieve the list of users from the current database a vector of all the users registered in the database



grantColumnPriv
public boolean grantColumnPriv(String username, String database, String table, String column, int privilege)(Code)
Grant a column privilege to a specific user
Parameters:
  username - User to grant privilege to
Parameters:
  database - Database on which to grant privilege
Parameters:
  table - Table on which to grant privilege
Parameters:
  column - Column on which to grant privilege
Parameters:
  privilege - Privilege to be granted true if successful, false if there was an error



grantColumnPriv
public boolean grantColumnPriv(String username, String database, String table, String[] columns, int privilege)(Code)
Grant a privilege on a list of columns to a specific user
Parameters:
  username - User to grant privilege to
Parameters:
  database - Database on which to grant privilege
Parameters:
  table - Table on which to grant privilege
Parameters:
  columns - Array of columns on which to grant privilege
Parameters:
  privilege - Privilege to be granted true if successful, false if there was an error



grantDBPriv
public boolean grantDBPriv(String username, String database, int privilege)(Code)
Grant a database privilege to a specific user
Parameters:
  username - User to grant privilege to
Parameters:
  database - Database on which to grant privilege
Parameters:
  privilege - Privilege to be granted true if successful, false if there was an error



grantGlobalPriv
public boolean grantGlobalPriv(String username, int privilege)(Code)
Grant a global privilege to a specific user
Parameters:
  username - User to grant privilege to
Parameters:
  privilege - Privilege to be granted true if successful, false if there was an error



grantTablePriv
public boolean grantTablePriv(String username, String database, String table, int privilege)(Code)
Grant a table privilege to a specific user
Parameters:
  username - User to grant privilege to
Parameters:
  database - Database on which to grant privilege
Parameters:
  table - Table on which to grant privilege
Parameters:
  privilege - Privilege to be granted true if successful, false if there was an error



isConnected
public boolean isConnected()(Code)
Check to see if there is a connection open. true if there is a connection open, false if not.



revokeColumnPriv
public boolean revokeColumnPriv(String username, String database, String table, String column, int privilege)(Code)
Revoke a column privilege from a specific user
Parameters:
  username - User to revoke privilege from
Parameters:
  database - Database from which to revoke privilege
Parameters:
  table - Table from which to revoke privilege
Parameters:
  column - Column from which to revoke privilege
Parameters:
  privilege - Privilege to be revoked true if successful, false if there was an error



revokeColumnPriv
public boolean revokeColumnPriv(String username, String database, String table, String[] columns, int privilege)(Code)
Revoke a privilege on a list of columns from a specific user
Parameters:
  username - User to revoke privilege from
Parameters:
  database - Database from which to revoke privilege
Parameters:
  table - Table from which to revoke privilege
Parameters:
  columns - Array of columns from which to revoke privilege
Parameters:
  privilege - Privilege to be revoked true if successful, false if there was an error



revokeDBPriv
public boolean revokeDBPriv(String username, String database, int privilege)(Code)
Revoke a database privilege from a specific user
Parameters:
  username - User to revoke privilege from
Parameters:
  database - Database from which to revoke privilege
Parameters:
  privilege - Privilege to be revoked true if successful, false if there was an error



revokeGlobalPriv
public boolean revokeGlobalPriv(String username, int privilege)(Code)
Revoke a global privilege from a specific user
Parameters:
  username - User to revoke privilege from
Parameters:
  privilege - Privilege to be revoked true if successful, false if there was an error



revokeTablePriv
public boolean revokeTablePriv(String username, String database, String table, int privilege)(Code)
Revoke a table privilege from a specific user
Parameters:
  username - User to revoke privilege from
Parameters:
  database - Database from which to revoke privilege
Parameters:
  table - Table from which to revoke privilege
Parameters:
  privilege - Privilege to be revoked true if successful, false if there was an error



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.