Source Code Cross Referenced for UIControllerForRawSQL.java in  » Database-Client » DBBrowser » org » dbbrowser » ui » 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 » DBBrowser » org.dbbrowser.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser.ui;
002:
003:        import infrastructure.logging.Log;
004:
005:        import java.sql.Connection;
006:        import java.sql.SQLException;
007:        import org.dbbrowser.db.engine.exception.DBEngineException;
008:        import org.dbbrowser.db.engine.model.DBTable;
009:        import org.dbbrowser.db.engine.rawsqlengine.DBRawSQLEngine;
010:        import org.dbbrowser.db.engine.rawsqlengine.GenericRawSQLEngine;
011:        import org.dbbrowser.drivermanager.ConnectionInfo;
012:        import org.dbbrowser.drivermanager.DBBrowserDriverManager;
013:        import org.dbbrowser.drivermanager.DriverManagerException;
014:
015:        /**
016:         * UI Controller for running raw SQL entered by the user
017:         */
018:        public class UIControllerForRawSQL {
019:            private ConnectionInfo connectionInfo = null;
020:            private DBRawSQLEngine dbRawSQLEngine = null;
021:
022:            /**
023:             * Connects to the database using the supplied connection info.  DirverManager caches the connection.  Start a DBQueryEngine
024:             * @param connectionInfo
025:             * @param masterPassword
026:             */
027:            public void setup(ConnectionInfo connectionInfo,
028:                    String masterPassword) throws DriverManagerException,
029:                    DBEngineException {
030:                this .connectionInfo = connectionInfo;
031:                Connection connection = DBBrowserDriverManager.getInstance()
032:                        .getConnection(connectionInfo, masterPassword);
033:
034:                try {
035:                    this .dbRawSQLEngine = new GenericRawSQLEngine(connection
036:                            .createStatement());
037:                } catch (SQLException exc) {
038:                    throw new DBEngineException(exc.getMessage());
039:                }
040:            }
041:
042:            /**
043:             * Return the connection info representing the connection
044:             * @return
045:             */
046:            public ConnectionInfo getConnectionInfo() {
047:                return this .connectionInfo;
048:            }
049:
050:            /**
051:             * Set auto commit
052:             * @param autoCommitFlag
053:             * @throws DBEngineException
054:             */
055:            public void setAutoCommit(boolean autoCommitFlag)
056:                    throws DBEngineException {
057:                try {
058:                    this .dbRawSQLEngine.getStatement().getConnection()
059:                            .setAutoCommit(autoCommitFlag);
060:                } catch (SQLException exc) {
061:                    throw new DBEngineException(exc.getMessage());
062:                }
063:            }
064:
065:            /**
066:             * Commit
067:             * @throws DBEngineException
068:             */
069:            public void commit() throws DBEngineException {
070:                try {
071:                    this .dbRawSQLEngine.getStatement().getConnection().commit();
072:                    Log.getInstance().debugMessage("Commit complete",
073:                            this .getClass().getName());
074:                } catch (SQLException exc) {
075:                    throw new DBEngineException(exc.getMessage());
076:                }
077:            }
078:
079:            /**
080:             * Rollback
081:             * @throws DBEngineException
082:             */
083:            public void rollback() throws DBEngineException {
084:                try {
085:                    this .dbRawSQLEngine.getStatement().getConnection()
086:                            .rollback();
087:                    Log.getInstance().debugMessage("Rollback complete",
088:                            this .getClass().getName());
089:                } catch (SQLException exc) {
090:                    throw new DBEngineException(exc.getMessage());
091:                }
092:            }
093:
094:            /**
095:             * Run the raw SQL statement.  Returns a DBTable if the query returns a result(SELECT queries)
096:             * @param sql
097:             * @return - DBTable or null if the query does not return anything
098:             * @throws DBEngineException
099:             */
100:            public DBTable runRawSQL(String sql) throws DBEngineException {
101:                return this.dbRawSQLEngine.runRawSQL(sql);
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.