Sie sind auf Seite 1von 15

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.

SRS
SQL QUERY GENERATOR

By Neha Mundada 4141 BE

Computer Engineering Department Academic Year: 2011-2012

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


index Chapter Name 1. Problem Definition 1.1 Problem statement 1.2 Keywords 1.3 Goals and Objective 1.4Application 1.5 Major functions 1.6 Input 1.7 Output 1.8 Hardware resource required 1.9 Software resource required 2. Software Requirements Specification 3. Software Design 4. Implementation Details 5. Conclusion 6. References Page No.

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


1. Problem definition : 1.1 Problem Statement : To design and implement software in Java that provides an interactive interface for database users there by automating the various operations performed in order to maintain the database. The software generates all necessary SQL queries and commands and relieves the user of the overhead of remembering SQL syntaxes. 1.2 Keywords : SQL(structured query language),JDBC(java database connectivity) 1.3 Goals and objective : Database systems are designed to manage large bodies of information. Management of data involves both defining structures for storage of information and providing mechanisms for the manipulation of information. In addition, the database system must ensure the safety of the information stored, despite system crashes or attempts at unauthorized access. If data are to be shared among several users, the system must avoid possible anomalous results. Databases are widely used. Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. Java Database Connectivity (JDBC) is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. The Java 2 Platform, Standard Edition, version 1.4 (J2SE) includes the JDBC 3.0 API[1] together with a reference implementation JDBC-to-ODBC bridge, enabling connections to any ODBC-accessible data source in the JVM host environment. Database may or may not come with their own SQL interface. Many a times the database administrator is expected to be well versed with the SQL commands and therefore will have to type and execute all queries for all operations that he wishes to perform. Database that provide SQL generation are specific to their own environment. The user needs to first get a hand over the tool and then start executing commands. Database specific interface may sometimes not be that powerful and might not give the user complete flexibility over the commands that is generated. This is due to the fact the administrator is assumed to be skilled in

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


his domain and write his own queries as per his needs. Inbuilt SQL generator are usually meant for nave users. On the other hand externally available SQL interfaces are highly powerful and provide various shortcuts and tool which turn out to be fast and handy to the administrator. Again a problem persist, that to gain greater capabilities these database interfaces are designed user or vendor specific. Hence there exist a need for an application that can act as a generic, at the same time should be customizable for database operations. Acting to this scenario we propose a system which is developed in java, trying to overcome difficulties that exist with other interfaces. As it is being developed in an Open Source environment, expansion to the project is at a vast scope. The current version is the first prototype being proposed and might not handle all cases. The application uses Oracle 10g as its own database in order to maintain relational data. 1.4 Application : . Here are some representative applications of databases. Thus this user friendly application is useful for the nave users in the following areas : Banking: For customer information, accounts, and loans, and banking transactions. Airlines: For reservations and schedule information. Airlines were among the first to use databases in a geographically distributed mannerterminals situated around the world accessed the central database system through phone lines and other data networks. Universities: For student information, course registrations, and grades. Credit card transactions: For purchases on credit cards and generation of monthly statements.

1.5 Major Functions : 1) Create table 2) Modify table 3) Add constraint 4) Query generated can be saved as well as executed 5) Delete constraint 1.6 Input: The input required is the data which is needed to construct the query. For example, 1)If we want to create the table, then the following data is provided through the given forms:

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


Column name and its datatype Table name Constraint name and its type 2)If we want to want to modify objects the following operations are done with following data: Add column-provide data for that column Delete column Add or remove constraint 1.7 Output : Output for various DML queries is obtained : 1.8 Hardware requirements: Personal computer 1.9 Software Requirements : 1)Netbeans 6.8 for java 2)Oracle 10g

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.

2. SOFTWARE REQUIREMENTS SPECIFICATION Introduction 2.1 Purpose To design and implement software in Java that provides an interactive interface for database users there by automating the various operations performed in order to maintain the database. The software generates all necessary SQL queries and commands and relieves the user of the overhead of remembering SQL syntaxes. 2.2 Scope The proposed System is a database administration tool. It uses JDBC to allow users to explore and interact with databases via a JDBC driver. It provides an interactive interface that allows users to select options and generate all necessary SQL queries at the click of a button. The software also offers code completion and syntax highlighting for standard SQL. 2.2.1 Definitions, acronyms, and abbreviations JDBC Java Database Connectivity ODBC Open Database Connectivity SQL- Structure query Language DML- Data Definition Language 2.2.2 References: 1.IEEE Recommended Practice for Software Requirements Specifications, Std. 830 2.Pressman, Roger S., 2001. Software Engineering, McGRAW-HILL, fifth edition 3.Software Project Management, Bob Hughes & Mike Cotterell, McGraw-Hill Publication, 2006. (Textbook) 2.3 Overview This report is prepared by using IEEE Std. 830 and constituted 3 parts. The first part of this report contains overall descriptions of the ORCH. It is about all the functions, dependencies, properties, development phase, perspectives and also constrains of the devised system. The second part of

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


report contains descriptions of specific requirements of the ORCH project. It defines what we will do and will not do. The last part of this SRS contains the Appendices and figures.

2.3.1 Product Overview While using a Relational Database System (RDBMS), you must have probably run across one or more of the following situations: Typing a long SQL statement to change one value in the DB. Re-typing the same SQL statement over and over, possibly with slight variations. Working with multiple databases on separate machines. Using databases from different vendors, such as Oracle, MySQL or PostgreSQL. Teachers, students, or other folks who need to work with databases but are not SQL experts. For anyone who needs to work with an RDBMS, the SQL Generator can make life easier. The user can click on tables to view them and edit data, or use full SQL operations. Data can be viewed in read-only mode for safety, or in an editable mode where it may be modified by simply typing the new data into the table. All of the meta-data for the database (eg: data types, table column names, etc.) are accessible through SQL Generator. In cases where multiple types of database engines are being used (eg: Oracle, MySQL, PostgreSQL, etc.), the user does not need to learn multiple DB-management tools since SQL Generator provides a common mechanism for accessing them all. Through the JDBC standard and todays broad availability of JDBC drivers the Java platform is able to access almost all relational databases. JDBC provides a formerly unknown level of uniformity and simplicity. Thus the JDBC API together with the Java platform offers software developers uniform and easy to use access to almost all relational databases.

2.3.2 Product perspective The Query generator is a package to be used by users to generate all necessary SQL queries and commands and relieves the user of the overhead of remembering SQL syntaxes.. This system is developed on the basis of benefits greatly to the users that are not comfortable with sql. 2.4 Product functions 1.Enable Table Creation Support 2. Query generated can be saved as well as executed 3. Adding Constraints Foreign Key

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


4. Error Handling and validation 5. Add Check Constraint 6. Modify Tables 2.5 User characteristics While using a Relational Database System (RDBMS), users must have probably run across one or more of the following situations: Typing a long SQL statement to change one value in the DB. Re-typing the same SQL statement over and over, possibly with slight variations. Working with multiple databases on separate machines. Using databases from different vendors, such as Oracle, MySQL or PostgreSQL. Teachers, students, or other folks who need to work with databases but are not SQL experts. For anyone who needs to work with an RDBMS, the SQL Generator can make life easier. The user can click on tables to view them and edit data, or use full SQL operations. Data can be viewed in read-only mode for safety, or in an editable mode where it may be modified by simply typing the new data into the table. All of the meta-data for the database (eg: data types, table column names, etc.) are accessible through SQL Generator. In cases where multiple types of database engines are being used (eg: Oracle, MySQL, PostgreSQL, etc.), the user does not need to learn multiple DB-management tools since SQL Generator provides a common mechanism for accessing them all. Through the JDBC standard and todays broad availability of JDBC drivers the Java platform is able to access almost all relational databases. JDBC provides a formerly unknown level of uniformity and simplicity. Thus the JDBC API together with the Java platform offers software developers uniform and easy to use access to almost all relational databases. 2.6 Constraints The application can only generate DDL queries. It cant generate DML queries. So this application will not help to create complex queries.. 2.7 Assumptions and dependencies -I- Front End Client: AWT, Swings -I- Data Base Server: MySQL Hardware Interface:

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


-|- Client Side: Monitor -|- Server Side: Load-Shared Servers

2.8 Specific requirements 2.8.1 Usage scenario This section provides a usage scenario for the software. It is the organized information collected during requirements elicitation into use-cases. 2.8.2 User profiles User : user will log into the application then using the GUI he will created the required query Use-cases

Create Table

Primary key Foreign key

Add constraints

Unique

Check constraint

Insert Records Database Administrator

Rename Table

Modify Table

Drop Table

Browse database objects Rename Column

Add Column

Delete Column

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


External Interface First of all, interface of Query Generator will be simple and easy to understand, because there are lots syntax in SQL and many of them can be complex to remember. The software shall have customizable menus, simple to use. 2.9 SOFTWARE SYSTEM ATTRIBUTES 2.9.1 Security In order to protect itself from accidental or malicious access, use or modification, the system shall enforce supply of a valid username and password pair, when any user attempts to login to the system. 2.9.2 Maintainability Query generator system is maintained by developer and database managers. When necessary database design is controlled and changed. Also,coding part will be changed according to necessary by developer. 2.9.3 Reliability The system has to operate 98% of the time. The number of defect should not exceed 10 perfunction. Firewall is installed on server side for reliability of system. Schema: Datatypes Attribute_Name DTNAME DTSIZE DTLITERAL Type and Size VARCHAR2(4000) NUMBER NUMBER Constraint Primary key Not Null Not Null

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


DB_USERS Attribute_Name UNAME UPASS DESIGN CONSTRAINTS User can generate only DDL query, he Cant generate DML queries; Type and Size VARCHAR2(4000) VARCHAR2(4000) Constraint Primary key Not Null

3. Software design : The proposed System is a database administration tool. It uses JDBC to allow users to explore and interact with databases via a JDBC driver. It provides an interactive interface that allows users to select options and generate all necessary SQL queries at the click of a button. The software also offers code completion and syntax highlighting for standard SQL. As the program has been written completely in Java, it provides an architecture that allows writers to modify much of the application's behavior to provide database-specific functionality or features that are database-independent. As this desktop application is written entirely in Java with Swing UI components, it should run on any platform that has a JVM. While using a Relational Database System (RDBMS), you must have probably run across one or more of the following situations: Typing a long SQL statement to change one value in the DB. Re-typing the same SQL statement over and over, possibly with slight variations. Working with multiple databases on separate machines. Using databases from different vendors, such as Oracle, MySQL or PostgreSQL. Teachers, students, or other folks who need to work with databases but are not SQL experts. For anyone who needs to work with an RDBMS, the SQL Generator can make life easier. The user can click on tables to view them and edit data, or use full SQL operations. Data can be viewed in read-only mode for safety, or in an editable mode where it may be modified by simply typing the new data into the table. All of the meta-data for the database (eg: data types, table column names, etc.) are accessible through SQL Generator. In cases where multiple types of database engines are being used (eg: Oracle, MySQL, PostgreSQL, etc.), the user does not need to learn multiple DB-management tools since SQL Generator provides a common mechanism for accessing them all.

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


Through the JDBC standard and todays broad availability of JDBC drivers the Java platform is able to access almost all relational databases. JDBC provides a formerly unknown level of uniformity and simplicity. Thus the JDBC API together with the Java platform offers software developers uniform and easy to use access to almost all relational databases. 4 . Implementation details : 1. Enable Table Creation Support

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


3. Adding Constraints Foreign Key4. Error Handling and validation

4. Error Handling and validation :

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.

5. Add Check Constraint

6. Modify Tables

P: F-SMR-UG/08/R0

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, Dhankawadi, Pune 43.


5. Conclusion : Thus, we have implanted an user friendly query(DDL) generator interface which can be used by nave users for the given applications and in the given application area. 6.References : a] A complete reference Java b] Java docx c] Sql queries Ivan bayross d] Oracle database

P: F-SMR-UG/08/R0

Das könnte Ihnen auch gefallen