You are on page 1of 41

1.

INTRODUCTION
SQL Work Bench is the project that goes around the development of GUI Universal Database Client. It is the project that is intended to make the connection to different databases from single interface in an easy, fair, faster and reliable. This software to be designed which deals with different databases and execute different kinds of SQL statements from a single Tool. Users can create the connections for each and every database and store it in the Tool. Later on the user can select connection name to connect to a particular database and start executing SQL statements. User can also execute select statements and see the results in the Tool only. All the statements which are executed can be stored in .SQL file and at a later of point of time the user can use that .SQL file to execute the same statements. Users can Commit or rollback the SQL statements.

1.1 PURPOSE OF THE PROJECT:


The purpose of the system are as follows: To connect to different kinds of databases from single GUI Tool with flexible and user-friendly screens. To commit or rollback the statement by just clicking the button. To undo, redo, cut, copy and paste the contents in text area of the tool. To switch to any database by just switching the connections. To display the results and to export those results to .CSV files. To set the Timeout values for the connections. To create the schemas from this tool.

1.2 PROBLEMS IN EXISTING SYSTEM:


More learning work. Command driven enviroment consoles. Adjusting the console to display the results effectively. Installing the client libraries in user system. User cant store the statements that he is executing. Manually storing the results in a file. Repeated execution of the same statements. Maintenance of schemas from consoles. Executing commit and rollback statements manually. Cant use undo, redo, cut, paste options effectively from consoles.

1.3 PROPOSED SYSTEM:


The user has to use GUI enviroment to connect to a database. Providing one universal database client which is used to maintain different databases from a single user interface. The user need not install any client libraries at the client system. Provides a facility to manage the schemas. The results to be displayed in the tool in effective manner Providing the minimum security. Reusing and holding the connection for some time.

1.4 SCOPE OF THE PROJECT:


GUI enviroment. Storing the SQL statements in .SQL file. Using the predefined connections. Connection to multiple databases in the same way. Providing the operations like cut, copy and paste inside Text Area. Providing overall reliability. Easy to use, effective and efficient. Easy to install.

2. ANALYSIS
2.1. SOFTWARE REQUIREMENTS:
Operating System Technologies Parser Back End : : : : Windows 2000 Professinal or XP J2SE, JFC Swing and XML SAX Parser Any Database

2.2 HARDWARE REQUIREMENTS:


Processor Memory Hard Disk Capacity : : : Pentium1 GHz 256 MB RAM 40GB

2.3 FEASIBILITY STUDY:


A feasibility study is an evaluation of a proposal designed to determine the difficulty in carrying out a designated task. Generally, a feasibility study precedes technical development and project implementation. In other words, a feasibility study is an evaluation or analysis of the potential impact of a proposed project. Some of the types of the feasibility study are: Operational feasibility Technical feasibility Economic feasibility

2.3.1 Operational Feasibility:


Operational feasibility is mainly concerned with issues like whether the system will be used if it is developed and implemented. Whether there will be resistance from users that will affect the possible application benefits? The essential questions that help in testing the operational feasibility of a system are following. Are the users not happy with current business practices? Will it reduce the time (operation) considerably? If yes, then they will welcome the change and the new system. Have the users been involved in the planning and development of the project? Early involvement reduces the probability of resistance towards the new system. Will the proposed system really benefit the organization? Does the overall response increase? Will accessibility of information be lost? Will the system effect the customers in considerable way? SQL Work Bench is highly user interactive application and network based. So it is highly operational. It is very simple to operate and even a novice person can use this system very easily. Most important thing is no training is needed for the user. No complicated command set is to be remembered or memorized. The system is fully operationally feasible.

2.3.2 Technical Feasibility:


The assessment is based on an outline design of system requirements in terms of Input, Processes, Output, Fields, Programs, and Procedures. This can be quantified in terms of volumes of data, trends, frequency of updating, etc. in order to estimate whether the new system will perform adequately or not. Technological feasibility is carried out to determine whether the company has the capability, in terms of software, hardware, personnel and expertise, to handle the completion of the project.

In technical feasibility mainly two issues are taken into consideration. Whether the required technology is available or not Whether the required resources are available or not SQL Work Bench needs any compatible J2SE software and a executable jar file support. The proposed system will be implemented in Java. All the required hardware and software are available with the organization. So the project can be developed with the exiting software. Hence the project is technically feasible. Since XML can also be used in any enviroment it is very much comfortable.

2.3.3 Economic Feasibility:


Economic analysis is the most frequently used method for evaluating the effectiveness of a new system. More commonly known as cost/benefit analysis, the procedure is to determine the benefits and savings that are expected from a candidate system and compare them with costs. If benefits outweigh costs, then the decision is made to design and implement the system. Cost Based Study: It is important to identify cost and benefit factors, which can be categorized as follows: 1. Development costs; and 2. Operating costs. This is an analysis of the costs to be incurred in the system and the benefits derivable out of the system.Time Based Study: This is an analysis of the time required to achieve a return on investments. the benefits derived from the system. The future value of a project is also a factor. SQL Work Bench is an application which involves very less cost as the server is already equipped with the required hardware and software configurations.So there is no cost of software and the development cost will be very less. As this application does not involve any money transaction so the operation cost will also be very less.

3. MODULES
GUI Module: This module provides a graphical interface to make use of the features
available in this tool. It catches the events and executes the functionality by co-ordinating with other modules.

Connections Module: This module provides a facility to create, edit and delete
different connections and connects to a database if the user selects a connection. It allows the user to switch over different connections by making use of the same interface at the front end.

SQL Module: This module allows the users to execute any SQL statement using this
tool and execute those statements on a particular database based on the selected connection. It allows us to make use of editing option cut, copy and paste in the SQL area. It also allows us to store the executed SQL statements into a file.

Transactions Module: It allows us to store support the transactions by making use


commit and rollback options from this tool. It also allows us to store the result of an SQL statement in .csv format for later use.

Export & Import Module: It allows us to export the database elements into a file
and import the same also.

4. SYSTEM DESIGN
4.1 UML DIAGRAMS: The Unified Modeling Language (UML) is a standard
language for specifying, visualizing, constructing, and constructing the artifacts of software systems. The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems. UML is very important parts of developing object oriented software and software development process. UML uses mostly graphical notations to express the design of software projects. UML helps project teams communicate, explore potential designs and validate the architectural design of software.

4.1.1 Use Case Diagram:


A use case illustrates a unit of functionality provided by the system. The main purpose of the use-case diagram is to help development teams visualize the functional requirements of a system, including the relationship of "actors" (human beings who will interact with the system) to essential processes, as well as the relationships among different use cases. Use-case diagrams generally show groups of use cases either all use cases for the complete system, or a breakout of a particular group of use cases with related functionality (e.g., all security administration-related use cases). A use-case diagram is typically used to communicate the high-level functions of the system and the system's scope.

Create new Connection Connection Pool Modify Connection Delete Connection Database tables Execute Query Sql file

Display Result Save sql statement

.csv file

export data

schema

Schema Management

Figure 4.1 Use Case diagram

4.1.2 Class Diagram: It is a collection of objects that shares the common properties
and relations. Every representation of a class includes name, attributes and responsibilities.

M a in A ct io n Fa ct o r y +Command M a in Co nt r o lle r +Mainview +Config Model +Connection Model +File Chooser +Openlist

Pa ne l Vie w +Content +newAction +openAction +saveAction +executeAction +commitAction +rollbackAction

M a in Vie w

P a n e l Dia lo g ue +Panel +Fill +GridX +GridY +Insets +WeightX +WeightY

Figure 4.2 Class diagram

4.1.3 Sequence Diagram:


10

Sequence diagrams show a detailed flow for a specific use case or even just part of a specific use case. They are almost self explanatory; they show the calls between the different objects in their sequence and can show, at a detailed level, different calls to different objects. A sequence diagram has two dimensions: The vertical dimension shows the sequence of messages/calls in the time order that they occur; the horizontal dimension shows the object instances to which the messages are sent.

User Main Window enter configure create() modify Delete Configure New Conn Modify Conn Delete Conn Settings

created updated delete

Figure 4.3 Sequence Diagram for Connection Management

11


User Window Conn Sql execute Display Sql File export get conn() open() run() get result() save() exportdate() execute() File saved

Figure 4.4 Sequence Diagram for Query Management 4.1.4 Collaboration Diagram:
UML Collaboration diagrams (interaction diagrams) illustrate the relationship and interaction between software objects. They require use cases, system operation contracts, and domain model to already exist. The collaboration diagram illustrates messages being sent between classes and objects (instances). A diagram is created for each system operation that relates to the current development cycle (iteration). Main Window Create Connection 12

Connection Management

Actio n

Edit Connection

Delete Connection

Execute SQL statements

SQL Area

Actio n

Save SQL File

Commit & Roll back

Store Result

Import/Export

Schema Management

Editing Options

Figure 4.5 Collaboration diagram

5. TECNOLOGIES / PLATFORMS USED


13

SWING
Swing is the primary Java GUI widget toolkit. It is part of Oracle's JAVA Foundation Classes (JFC) an API for providing a graphical user interface (GUI) for Java programs. Swing provides a native look and feel that emulates the look and feel of several platforms. In addition to familiar components such as buttons, check box and labels, Swing provides several advanced components such as tabbed panel, scroll panes, trees, tables and lists.

The Main Window


Almost all GUI applications have a main or top-level window. In Swing, such window is usually instance of JFrame or JWindow. The difference between those two classes is in simplicity JWindow is much simpler than JFrame (most noticeable are visual differences - JWindow does not have a title bar, and does not put a button in the operating system task bar). So, your applications will almost always start with a JFrame. Though you can instantiate a JFrame and add components to it, a good practice is to encapsulate and group the code for a single visual frame in a separate class. Usually, I subclass the JFrame and initialize all visual elements of that frame in the constructor. Always pass a title to the parent class constructor that String will be displayed in the title bar and on the task bar. Also, remember to always initialize frame size (by calling setSize(width,height)), or your frame will not be noticeable on the screen.

Adding Components
Now is the time to add some components to the window. In Swing (and the Swing predecessor, AWT) all visual objects are subclasses of Component class. The Composite pattern was applied here to group visual objects into Containers, special components that can contain other components. Containers can specify the order, size and position of embedded components (and this can all be automatically calculated, which is one of the best features of Swing).

14

JButton is a component class that represents a general purpose button it can have a text caption or an icon, and can be pressed to invoke an action. Lets add the button to the frame (note: add imports for javax.swing.* and java.awt.* to the MainFrame source code so that you can use all the components). When you work with JFrame, you want to put objects into its content pane special container intended to hold the window contents. Obtain the reference to that container with the getContentPane() method.

Handling Actions and Events:


The central mechanism for response to user actions is the Observer pattern, implemented in Swing with event listeners. Components publish notifications about events, and event listeners receive these notifications. For example, to execute a code when user presses a button, you should define a listener for the button pressing event and register it with that button. ActionListener interface has just one method: actionPerformed. That method is called when an action occurs. The event type ActionEvent is the most common in Swing most components produce an ActionEvent. Components may also produce other events such as change of the current selection, text or size. For now, you should be most concerned with ActionEvent. In any case, in an IDE that can display methods of a class and look for methods that begin with add and end with Listener (for example, addFocusListener) to see what listener/event types a component supports.

JAVA
Java is a powerful but lean object oriented programming language .It has generated a lot of excitement because it makes it possible to program for Internet by creating applets, programs that can be embedded in web page. The context of an applet is limited only by ones imagination. For example, an applet can be animation with sound, an interactive game or a ticker tape with constantly updated stock prices. Applets can be just little decorations to liven up web page, or they can be serious applications like word processors or spreadsheet. 15

But Java is more than a programming language for writing applets. It is being used more and more for writing standalone applications as well. It is becoming so popular that many people believe it will become standard language for both general purpose and Internet programming. There are many buzzwords associated with Java, but because of its spectacular growth in popularity, a new buzzword has appeared ubiquitous. Indeed, all indications are that it will soon be everywhere. Java builds on the strength of C++. It has taken the best features of C++ and discarded the more problematic and error prone parts. To this lean core, it has added garbage collection (automatic memory management), multi-threading (the capacity for one program to do more than one thing at a time), security capabilities. The result is that Java is simple, elegant, powerful and easy to use. Java is actually a platform consisting of three components. Java programming language. Java library of classes and interfaces. Java virtual Machine.

There are many reasons why java is preferable and they are described as follows, Simple Java was designed to be easy for the professional programmer to learn and use effectively. Java will be even easy if we already thorough in the concept of object oriented. Some of confusing concepts are left out of java or implemented in a cleaner, more approachable manner. Object Oriented

16

The Java programming language is object oriented, which makes program design focus on what you are dealing with rather than on how you are going to do something. This makes it more useful for programming in sophisticated projects because one can break the things down into understandable components. A big benefit is that these components can then be reused. Java includes inheritance, or the ability to derive new classes from existing classes. The derived class, also called a subclass, inherits all the data and functions of the existing class, referred to as the parent class. A subclass can add new data members to those inherited from the parent class. As far as methods are concerned, the subclass can reuse the inherited methods, as it is, change them, and/or add its own new methods. Portable One of the biggest advantages Java offers is that it is portable. An application written in Java will run on all the major platforms. Any computer with a Java based browser can run the applications or applets written in the Java programming language. A programmer no longer has to write one program to run on a Macintosh, another program to run on a Windows machine, still another to run on UNIX machine, and so on. In other words, with Java, developers write their programs only once. The virtual machine is what gives Java is cross platform capabilities. code is compiled into byte codes. In Summary, these means that with the JDBC API extending Java, a programmer writing Java code can access all the major relational databases on any platform that supports the Java virtual machine. Robust The multi platform environment of the web places extraordinary demands on a program, because the program must execute reliably in a variety of systems. Thus, the ability to create robust programs were given a high priority in the design of java. However, Rather than being compiled into machine language, which is different for each operating systems and computer architecture, Java

17

it also checks our code at run time. In fact, many space hard-to-down bugs that often turn up in hard-to reproduce run time situations are simply impossible to create in java. Security Every time that we download a normal program, we are risking a viral infection. Prior to java most users did not download executable programs frequently, and those who did scanned them for viruses prior to execution. Even so, most users still worried about the possibilities of infecting their systems with a virus. Multithreaded Java was designed to meet the real-world requirement of creating interactive, networked programs. To accomplish this, java supports multithreaded programming, which allows us to write programs that do many things simultaneously. The java run-time system comes with an elegant yet sophisticated solution for multi process synchronization that enables us to construct smoothly running interactive systems. Interpreted and high performance Java enables the creation of cross-platform programs by compiling into an intermediate representation called java byte code. This code can be interpreted on any system tat provides a java Virtual Machine. Most previous attempts at cross-platform solutions have done so at the expense of performance. Other interpreted system, such as BASIC, Tcl and PEAL, suffer from almost insurmountable performance deficits. Java, however, was designed to perform well on very low power CPUs. Distributed Java is built with network communications in mind. It has a comprehensive library of routines for dealing with network protocols such as TCP/IP, HTTP and FTP. As a result, Java application can open and access objects across the Internets with the same ease that programmers normally expects while accessing a local file system. Dynamic 18

Fundamentally, distributed computing environment must be dynamic Java was designed to adapt in a constantly evolving environment. It is capable of incorporating new functionality regard less of where that functionality comes from-the local computer system, the local and wide area networks, and the internet are all potential contributors. Garbage Collection Automatically takes care of allocating and de-allocating memory, a huge potential source of errors. If an object is no longer being used (has no references to it), then it is automatically removed from memory, or Garbage Collected. Programmers dont have to keep track of what has been allocated and de-allocated them, which makes their job a lot easier, but more importantly it stops memory leaks.

JDBC
JDBC is a Java TM API for executing SQL statements. It consists of a set of classes and interfaces that are written in the Java programming language that makes it easy to sent SQL statements to virtually any relational database. In other words, with the JDBC API, it isnt necessary to write one program to access a Sybase database, any other program to access an Oracle database, another to access Informix database, and so on. One can write a single program using JDBC API and the program will be able to send SQL statements to appropriate database. And with a program written in Java, one also does not to worry about writing different programs to run on different platforms. The combination of Java and JDBC lets a programmer writes it once and run it anywhere. Java, being robust, secure, easy to understand, easy to use, and automatically downloadable on a network, is an excellent language basis for database applications. JDBC is the mechanism for Java applications to talk to variety of different databases. JDBC extends what you can do in Java. For example, with Java and JDBC API it is possible to publish a web page containing an applet that uses information obtained from a remote

19

database. With more and more programmers using Java the need for easy database access from Java is continuing to grow. JDBC makes it possible to do three things: Establishes the connection to databases. Send SQL statements. Process the results. JDBC is a low-level API and a base for Higher-level API. JDBC is a low-level interface, which means that it is used to invoke SQL commands directly .It works very well in this capacity and is easy to use than any other database connectivity APIs. But it was designed also to be a base upon which to build higher-level interfaces and tools. A higherlevel interface is user-friendly using a more understandable or more convenient API that is translated behind the scenes into a low-level interface such as JDBC.

Java Developer Kit


Java Soft provides three JDBC product components as part of the Java Developers Kit (JDK). JDBC Driver manager. JDBC driver test suit, and JDBC-ODBC bridge.

The JDBC driver manager is the backbone of JDBC architecture. It actually is quite small and simple, its primary function is to connect Java applications to the correct JDBC driver and then get out of the way. The JDBC driver test suit provides some confidence that JDBC drivers will run your program. It tests that a JDBC driver implements all of the JDBC classes and methods and that it provides the Entry Level SQL functionality required for JDBC compliance.

20

The JDBC-ODBC Bridge allows ODBC drivers to be used as JDBC drivers. It was implemented as way to get off the ground quickly, and long term will provide a way to access some of the less popular DBMS if JDBC are not implemented.

General Concepts OF JFC-Swing


GUI programming with Java Java provides a set of user interface components The set is the same across Unix, Windows and the Macintosh. The user interface components can be used for applets and for applications. The set allows cross-platform applications and applets to be built.

Evolution of Java GUI programming The AWT (Abstract Window Toolkit) has been present in all versions of Java. The AWT objects are built above native code objects, giving a native look and feel. The AWT objects are a least common denominator of all platforms. The Swing objects are a separate library for JDK 1.1. The Swing objects are in pure Java, and have the same look-and-feel on all platforms. The L&F of Swing objects can be customized to particular styles. In JDK 1.2, the Swing objects are part of the Java Foundation Classes. The JFC objects will provide a superset of each platform's objects. The AWT objects will decrease in importance over time.

21

AWT Hierarchy

``Primitive'' objects are directly derived from Component. LayoutManager is used for geometry management. LayoutManager2 fixes some deficiencies in LayoutManager (from JDK 1.1 on). AWT Event encodes all the event information. Component Peer objects are used to give the native implementation, and should be ignored most of the time.

22

AWT Primitive Components:


The main ``primitive'' objects derived from Component are

These are all in package java.awt.

Swing Primitive Components:

23

These mirror the AWT components:

There are additional components as well . In general, to each AWT component is a Swing component. As much as possible, each Swing component has the same methods and behavior as its corresponding AWT component.

Container Components :
Container objects are derived from Component. The main ones derived from that are Dialog File Dialog Frame Panel Window

24

Menu Components :
Menus are implemented by subclass. Menu Component which is derived from Object Checkbox Menu Item Menu Menu Bar Menu Item

Layout Objects :
Layout objects derive from Object and are used for geometry management Border Layout Card Layout Flow Layout Grid Layout Grid Bag Layout

COMPONENTS :
Component Objects Component has a number of methods inherited by all objects derived from it. Some methods set state setEnabled() (replaces enable()/disable()) setVisible() (replaces hide()/show()) setBackground(Color) setFont(Font)

Other methods are informational 25

boolean isEnabled() boolean isShowing() color getBackground()

6. INTEGRATION AND TESTING

6.1 INTEGRATION:
Integration is all about combining the individual parts of the system and making the system into a single unit. Here in this SQL Work Bench we are combining the modules User interface Database

6.2 TESTING:
Testing is a process of executing a program with the indent of finding an error. Testing is a crucial element of software quality assurance and presents ultimate review of specification, design and coding.

Testing Objectives
1. Testing is a process of executing a program with the intent of finding an error 2. A good test case is one that has a probability of finding an as yet undiscovered error 3. A successful test is one that uncovers an undiscovered error

Testing Principles
All tests should be traceable to end user requirements Tests should be planned long before testing begins 26

Testing should begin on a small scale and progress towards testing in large Exhaustive testing is not possible

To be most effective testing should be conducted by a independent third party. The primary objective for test case design is to derive a set of tests that has the highest livelihood for uncovering defects in software. To accomplish this objective two different categories of test case design techniques are used. They are White-box testing. Black-box testing.

White-box testing:
White box testing focus on the program control structure. Test cases are derived to ensure that all statements in the program have been executed at least once during testing and that all logical conditions have been executed.

Block-box testing:
Black box testing is designed to validate functional requirements without regard to the internal workings of a program. Black box testing mainly focuses on the information domain of the software, deriving test cases by partitioning input and output in a manner that provides through test coverage. Incorrect and missing functions, interface errors, errors in data structures, error in functional logic are the errors falling in this category.

Testing strategies
A strategy for software testing must accommodate low-level tests that are necessary to verify that all small source code segment has been correctly implemented as well as high-level tests that validate major system functions against customer requirements.

Testing fundamentals

27

Testing is a process of executing program with the intent of finding error. A good test case is one that has high probability of finding an undiscovered error. If testing is conducted successfully it uncovers the errors in the software. Testing cannot show the absence of defects, it can only show that software defects present.

Testing Information flow


Information flow for testing flows the pattern. Two class of input provided to test the process. The software configuration includes a software requirements specification, a design specification and source code.

Unit testing:
Unit testing is essential for the verification of the code produced during the coding phase and hence the goal is to test the internal logic of the modules. Using the detailed design description as a guide, important paths are tested to uncover errors with in the boundary of the modules. These tests were carried out during the programming stage itself. All units of SQL Work Bench were successfully tested.

Integration testing:
Integration testing focuses on unit tested modules and build the program structure that is dictated by the design phase.

System testing:
System testing tests the integration of each module in the system. It also tests to find discrepancies between the system and its original objective, current specification and system documentation. The primary concern is the compatibility of individual modules. Entire system is working properly or not will be tested here, and specified path ODBC connection will correct or not, and giving output or not are tested here these verifications and validations are done by giving input values to the system and by comparing with expected output. Top-down testing implementing here.

28

Acceptance Testing:
This testing is done to verify the readiness of the system for the implementation. Acceptance testing begins when the system is complete. Its purpose is to provide the end user with the confidence that the system is ready for use. It involves planning and execution of functional tests, performance tests and stress tests in order to demonstrate that the implemented system satisfies its requirements.

Validation testing : It is the step where requirement established as apart of the software requirements
analysis are validated against the software meet all-functional and behavioral performance requirements and the errors, which are uncovered during the testing, are corrected. Form level and as well as field level validations are performed in all the data entry screens.

Test Cases
Test cases are derived to ensure that all statements in the program have been executed at least once during testing and that all logical conditions have been executed.

7. OUTPUT SCREENS
29

Figure 7.1 Home page

30

Figure 7.2 Establishing the connection to the database

31

Figure 7.3 Connecting to the database

32

Figure 7.4 Executing a query

33

Figure 7.5 Displaying the contents of the database

34

Figure 7.6 Saving the SQL commands for future use

35

Figure 7.7 Export table contents to .CSV file

36

Figure 7.8 Contents of the .CSV file

37

Figure 7.9 Connecting to another database

38

Figure 7.10 Deleting a connection

8. CONCLUSION

39

SQL Work Bench has been developed after a detailed study of the existing manual system. After the completion of the coding of the projects, the developed application was tested on different kinds of databases with different SQL statements to check the accuracy of the data manipulation from single window and their associated outputs. This software Tool is advantageous and highly useful, overcoming the conventional techniques, which were not easy. More over, it takes lot of time to learn how to use a console to each and every database and start working on it by executing SQL statements. The software developed eradicates all those hurdles and easy to use and satisfies all the necessary formalities. It has been developed with systematic design principles confirming to the step of the system development life cycle. The system has been modularly developed and implemented interrelation between the modules and thereby overcoming the drawbacks of the manual system. SQL Work Bench provides the better GUI Universal database client to easily connect and work with any kind of database. The software is user friendly for both the users and the administrator.

9. BIBILIOGRAPHY
40

PL/SQL Programming by Scott Urman SQL complete reference by Livion HTML Complete reference by Thomas A. Powell JFC-Swing by Sun Press Java Complete reference by Patric Naugthon,Herbert Schildt Java Script Programming by Yehuda Shiran Java Database Programming with JDBC by Patel Moss Software Engineering by Roger S.Pressman

41