Main (repaired)

438 views
381 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
438
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Main (repaired)

  1. 1. ACKNOWLEDGEMENTS We are greatly indebted to all those who have rendered help forsuccessful completion of this project. We express our deep- sense of gratitude andsincere thanks to our principal Mr. P.V.Sugathan who had provided the necessaryfacilities to do our project. We are also very thankful to Mrs. Nisha Rose , Head of theComputer Science & Engineering Department, and Mrs. Sumija, our tutor, Mrs.Sajna, our project guide for her master guidance, intelligent suggestions andpatient effort that paved the way for our successful completion of this project. We express our heartfelt gratitude to IPCS s/w Ltd. (Calicut) forproviding us the facilities. Above all we are indebted to the Lord Almighty forgiving us the courage and strength.
  2. 2. ABSTRACT Many sophisticated computer applications could be significantlysimplified if they are built on top of a general-purpose distributed databasemanagement system. In spite of much research on distributed database managementsystems there are only a few homogenous distributed database system architectures,that have reached the development stage. The situation with heterogeneousmultidatabase systems, which connect a number of possibly incompatible pre-existingdatabase systems, is even less satisfactory. HetrogeniousDatabase Management System (DDMS) is speciallydeveloped for Heterogeneous Database Platforms. ‘Distributed DatabaseManagement System’ focus mainly on heterogeneous distributed data management.It is a system for managing databases stored on multiple computers in a network.
  3. 3. List of FiguresFigure 8.1 Login page..................................................................................................71Figure 8.2 Single table import.....................................................................................71Figure 8.3 Single Export..............................................................................................72Figure 8.4 Query Analyzer..........................................................................................72Figure 8.5 Multiple Export..........................................................................................73Figure 8.6 Multiple Import..........................................................................................73Figure 8.7 Setting Privillages ......................................................................................74
  4. 4. Table of contents Acknowledgements……………………………………………………….………iii Abstract……………………………………………………………………………iv List of Figures………………………………………………………………….....vi1. Introduction................................................................................................................6 1.1 OBJECTIVE........................................................................................................62. SYSTEM STUDY....................................................................................................7 2.1 EXISTING SYSTEM..........................................................................................7 2.2 Proposed System..................................................................................................73. SYSTEM REQUIREMENTS....................................................................................9 3.1 HARDWARE REQUIREMENTS.......................................................................9 3.2 Software Specification........................................................................................9 3.3 SOFTWARE DESCRIPTION............................................................................94.MODULES IN SOFTWARE...................................................................................24 4.1HDMS ADMINISTRATOR...............................................................................24 4.2 HDMS CLIENT.................................................................................................255. DATA FLOW DIAGRAM......................................................................................27 5.1 LEVEL 0 DFD...................................................................................................28 5.2 LEVEL 1 DFD query analyzer..........................................................................29 5.3 LEVEL 1 DFD TABLE EXPORT....................................................................30 5.4 LEVEL 1 DFD TABLE IMPORT.....................................................................31 5.4 LEVEL 2 DFD...................................................................................................326. CODING..................................................................................................................33 6.1 MAIN FUNCTIONS ........................................................................................33 6.2 QUERY ANALYZER.......................................................................................42 6.3 IMPORTING TABLES.....................................................................................48 6.4 EXPORTING TABLES.....................................................................................597. DESIGN AND IMPLEMENTATION....................................................................69 7.1 INPUT DESIGN ...............................................................................................69 7.2 COMPONENT DESIGN...................................................................................69 7.3 OUTPUT DESIGN............................................................................................69 7.4 DATABASE DESIGN.......................................................................................708. SCREENSHOTS......................................................................................................719. SYSTEM TESTING................................................................................................7510. CONCLUSION......................................................................................................76Cost Estimation Report................................................................................................77REFERENCES............................................................................................................78
  5. 5. HDBMS1. Introduction Many sophisticated computer applications could be significantlysimplified if they are built on top of a general-purpose distributed databasemanagement system. In spite of much research on distributed database managementsystems there are only a few homogenous distributed database system architectures,that have reached the development stage. The situation with heterogeneousmultidatabase systems, which connect a number of possibly incompatible pre-existingdatabase systems, is even less satisfactory. HetrogeniousDatabase Management System (HDMS) is speciallydeveloped for Heterogeneous Database Platforms. ‘Distributed DatabaseManagement System’ focus mainly on heterogeneous distributed data management.It is a system for managing databases stored on multiple computers in a network. A distributed database is a set of databases stored on multiplecomputers that typically appears to applications as a single database. Consequently,an application can simultaneously access and modify the data in several databases ina network. Distributed Database management System is a software system thatmanages a distributed database while making the distribution transparent to the user.1.1 OBJECTIVE It is increasingly important for organizations to achieve additionalcoordination of diverse computerized operations. To do so, it is necessary to havedatabase systems that can operate over a distributed network and can encompass aheterogeneous mix of computers, operating systems, communications links, and localdatabase management systems.A distributed database is a set of databases stored on multiple computers thattypically appears to applications as a single database. Consequently, an applicationcan simultaneously access and modify the data in several databases in a network.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 6
  6. 6. HDBMSDistributed Database management System is a software system that manages adistributed database while making the distribution transparent to the user.2. SYSTEM STUDY2.1 EXISTING SYSTEMThink of an enterprise of (say) more than 100 computers that act as database clients.If there is only one database server, then all the queries sent by these clients have tobe answered by the same single server. This will lead to severe traffic congestion atthe server and also in the network.It is common in an enterprise to have many departments. Each of these departmentswill need access to a common database used throughout in the Enterprise. Howeverthe majority of data requirements of each of these departments will be departmentspecific.2.1.1 LIMITATIONS OF EXISTING SYSTEM 1. Does not support heterogeneous databases. 2. Difficulty in managing distributed data.2.2 Proposed System The proposed system to develop a software for Distributed database system in the Diverse database management systems are used in large organizations. The heterogeneous distributed database system can provide a flexible integration of diverse databases for users and applications. This is because it allows for retrieval and update of distributed data under different data systems giving the illusion of accessing a single centralized database system.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 7
  7. 7. HDBMS2.2.1 ADVANTAGES OF PROPOSED SYSTEM  Supports heterogeneous database applications.  Suitable in Linux, Windows or any other platform.  Better management of distributed data.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 8
  8. 8. HDBMS3. SYSTEM REQUIREMENTS3.1 HARDWARE REQUIREMENTSA recommended configuration is followsMicro Processor : Pentium IV 2.6 GHzCPU Clock : 512 MHzSystem Bus : 32 BitsRam : 512 MBHard Disk Capacity : 80 GBFloppy Disk : 144 KBVDU : SVGAKeyboard : Standard 108 KeysMouse : Serial 3 Button, LogitechMonitor : SVGA Color3.2 Software SpecificationOperating system. : Linux /Windows XP/ Windows 2000/Windows 98Front end. : Java-J2EEBack end. : MS-ACCESS, SQL, and Oracle3.3 SOFTWARE DESCRIPTION3.3.1 FRONTEND SOFTWAREJava Soft, an operating company of Sun Microsystems, spent years developing ahigh-powered programming language for the ‘90s and beyond. Java delivers on thispromise by being the most robust, easy-to-use, and versatile programming languageavailable today. It includes the best aspects of earlier programming languages such asC and C++, allows you to create powerful applications, has features such as built-inmultimedia capabilities that make creating multimedia presentations easier than ever,and leaves out those things we all hated about C and C++ like multiple inheritance,operator overloading, and pointers.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 9
  9. 9. HDBMS The best news about Java is that it is object oriented and architecture neutral.The promise of object-oriented programming (OOP) is the capability to reuse code.But, as C++ programmers will tell you, good intentions do not mean a whole lot whenit comes to reuse of C++ code. With Java, on the other hand, you can realize thebenefits of code reuse immediately. You no longer have to develop separate applications for different platforms.With Java, you can develop a single application that is immediately usable onmultiple platforms. Imagine the countless hours you will save by being able todevelop a single application usable on Windows, UNIX, and Macintosh systems. For the entrepreneur or individual programmer, Java’s platform independenceallows you to develop powerful applications for operating systems you may neverhave worked with. This means that if you own a software-development or Internet-related business, whether it is a one-person operation or a conglomerate, you will beable to reach new customers and new markets. In an age when everyone is looking atthe bottom line, a technology that allows you to sell more, do more, and reach largeraudiences (potentially everyone who owns a computer) is certainly something worthinvestigating. Furthermore, by allowing you to use the programming environment you arethe most comfortable with, Java empowers you, the programmer. This is true whetheryou have limited technical skills or expert knowledge of computers. If you have aworking knowledge of another programming language, you will find that Java issurprisingly easy to learn. The developers of Java thought very carefully about the structure of their newlanguage and by no mere coincidence modeled Java after C and C++. C is a favoritelanguage for programmers doing procedural programming. C++ is a favorite languagefor programmers writing object-oriented programs. C and C++ have user anddeveloper bases many times greater than their nearest competitors and could, in fact,be considered to be their own best competition.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 10
  10. 10. HDBMS Therefore, to ensure that Java is easy to understand and use, Java is modeledafter C and C++. Java also borrows extensions from Objective C. These extensionsallow for extremely dynamic method resolution. This makes it very easy for currentC, Objective C, and C++ developers to transition to Java. Any programmer who has ever had problems with pointers and memorymanagement should rush to embrace Java with open arms. Java gets rid of pointers,automatically manages memory for you, and even features a garbage-collectionroutine that runs in the background. In distributed environments, such as the World Wide Web, strict securitymechanisms are essential-businesses simply cannot risk compromising their systems.The developers of the Java programming language knew this. They developed Java tobe the most secure programming environment you will find anywhere. Java doesn’tjust fix security loopholes-it eliminates them, which makes Java the perfect languagefor programming on the Web. Pointers are the biggest security problem with C/C++ programs. Systemcrackers can use seemingly benign programs to forge pointers to memory, stealinformation from your system, and crash your system permanently. In Java, you can’tforge pointers to memory because there are no pointers. Java eliminates many othersecurity loopholes as well. For example, when Java programs are compiled and run,they are checked with a dynamic code verifier to ensure that the program has nomalicious coding. Additionally, the Java runtime environment provides strict rules forprograms started from remote hosts. These programs cannot access the local network,cannot access files on your local system, and cannot start programs on your systemseither.Programming with Java Java is first and foremost an object-oriented programming language.Many programmers are surprised when they discover how easy it is to follow soundDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 11
  11. 11. HDBMSobject-oriented design practices with Java. The following sections give you a betterunderstanding of what Java offers.Java’s magic: the byte code Byte code is a highly optimized set of instructions designed to beexecuted by the Java run-time system, which is called the Java Virtual Machine(JVM). In its standard form, JVM is an interpreter for Byte code. When a Java program is compiled using the “javac” command, thecomplier generates a class file, which is also known as the Byte code. This Byte codeis then fed into the JVM, which consists of a Compiler, Byte Code Verifier and anInterpreter embedded in it. The Byte code passes through all of these and finally theJVM generates the output. SYSTEM .class files JAVA VIRTUAL MACHINE (JVM) BYTE COMPILER COMPILER INTERPRETER CODE Javac filename BYTE CODE FORMATION OF JAVAJAVA FEATURES The inventors of java wanted to design a language, whichcould offer solutions to some of the problems encountered in modern programming.They wanted the language to not only be reliable, portable and distributed but alsosimple, compact and interactive. Sun Microsystems officially describes Java with thefollowing attributes:Compiled and InterpretedDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 12
  12. 12. HDBMS Usually a computer language is either compiled or interpreted. Javacombines both these approaches thus making Java a two-stage system. First, Javacompiler translates source code into what is known as byte code instructions. Bytecodes are not machine instructions and therefore, in the second stage, Java interpretergenerates machine code that can be directly executed by the machine that is runningthe Java program.Platform-independent and portable The most significant contribution of Java over other languages is itsportability. Java programs can be easily moved from the one computer system toanother, anywhere and anytime. Changes and upgrade in operating systems,processors and system resources not will force any changes in Java programs. This isthe reason why Java has become a popular language for programming on Internet,which interconnects different kinds of systems worldwide. We can download, a Javaapplet from a remote computer onto our local system via Internet and execute itlocally. This makes the Internet an extension of the user’s basic system providingpractically unlimited number of accessible applets and applications. Java ensures portability in two ways. First, Java compiler generatesbyte code instructions that can be implemented on any machine. Secondly, the sizesof the primitive data types are machine-independent.Object-oriented Java is a true object-oriented language. Almost every time in Java is anobject. All program code and data reside within objects and classes. Java comes withan extensive of classes, arranged in packages, which we can use in our programs byinheritance. The object model in Java is simple and easy to extend.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 13
  13. 13. HDBMSRobust and secure Java is a robust language. It provides many safeguards to ensurereliable code. It has strict compile time and run time checking for data types. It isdesigned as a garbage-collected language relieving the programmers virtually allmemory management problems. Java also incorporates the concept of exceptionhandling, which captures series errors and eliminates any risk of crashing the system. Security becomes an important issue for a language that is used forprogramming on Internet. Threat of viruses and abuse of resources is everywhere.Java systems not only verify all memory access but also ensure that no viruses arecommunicated with an applet. The absence of pointers in Java ensures that programscannot gain access to memory locations without proper authorization.Distributed Java is designed as a distributed language for creating applications onnetworks. It has the ability to share both data and programs. Java applications canopen and access remote objects on Internet as easily as they can do in a local system.This enables multiple programming at multiple remote locations to collaborate andwork together on a single project.Simple, small and familiar Java is a small and simple language. Many features of C and C++ thatare either redundant or sources of unreliable code are not part of Java. Thus Java doesnot use pointers, preprocessor header files, go to statement and many others. It alsoeliminates operator overloading and multiple inheritance. Familiarity is anotherstriking feature of Java. To make the language look familiar to the existingprogrammers, it was modeled on C and C++ languages. Java uses many constructs ofC and C++ and therefore, Java code “looks like a C++” code. In fact, Java is asimplified version of C++.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 14
  14. 14. HDBMSMultithreaded and interactive Multithreaded means handling multiple tasks simultaneously. Javasupports multithreaded programs. This means that we need not wait for theapplication to finish, one task before beginning another. For example, we can listen toan audio clip while scrolling a page and at the same time download as applet from adistant computer. This feature greatly improves the interactive performance ofgraphical applications. The Java runtime comes with tools that support multiprocesssynchronization and construct smoothly running interactive systems.High performance Java performance is impressive for an interpreted language, mainlydue to the user of intermediate byte code. According to Sun, Java speed is comparableto the native C/C++. Java architecture is also designed to reduce overheads duringruntime. Further, the incorporation of multithreading enhances the overall executionspeed of the Java programs.Dynamic and Extensible Java is a dynamic language. Java is capable of dynamic linking in newclass libraries, methods, and objects. Java also determines the type of the classthrough a query, making it possible to either dynamically link or abort the program,depending on the response. Java programs support functions written in other languages such as Cand C++. These functions are known as native methods. This facility enables theprogrammers to use the efficient function available in these languages. Nativemethods are linked dynamically at runtimeJFC (Java Foundation Class)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 15
  15. 15. HDBMS JFC contains 5 major technologies namely Swing, Abstract WindowToolkit (AWT), Accessibility, Drag and Drop and 2D Graphics .All the technologies,except, Drag and Drop and Accessibility API have been used in this project. We shall see a brief sketch of all of these.Accessibility API Assistive technologies (or systems) are useful for disabled people whoneed additional help to use the user interface. The assistive systems include screenreaders, screen magnifiers and speech recognition systems. The Accessibility APIprovides an interface that allows assistive technologies to interact and communicatewith JFC and AWT components.Abstract Window Toolkit (AWT) The AWT is not new to Java Programmers. The AWT is thecornerstone for the JFC itself and is one of the core libraries that were launched withJDK1.0.In fact; the AWT lays foundation for the Swing components. While you cancreate the user interface with Swing components, you still need to use the layoutmanagers and event models supported in AWT2D Graphics The API in the AWT supports graphics to some extent in Javaprogramming. However, as the Java technology started maturing, the necessity toincorporate a more sophisticated graphics API was recognized. The 2D Graphics APIcan support advanced 2D graphics and imagingDrag and drop With native platform-capable drag-and-drop, a user with a nativeapplication sitting next to a java application will be able to drag-and-drop between theDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 16
  16. 16. HDBMSjava and native applications. The level of precision in the user gesture (dragmovement) will be consistent with that of the host native platform.Java Swings Swing development has it roots in the Model-View-Controller (MVC)architecture. The MVC-based architecture allows Swing components to be replacedwith different data models and views. The pluggable look-and-feel is the result of theMVC architecture. Because Java is a platform-independent language and runs on anyclient machine, you should be able to harness the look-and-feel of just about anyplatform.SWING FEATURES AND CONCEPTSSwing components and the containment hierarchy Swing provides many standard GUI components such as buttons, lists,menus, and text areas, which you combine to create your program’s GUI. It alsoincludes containers such as windows and tool bars.Layout management Containers use layout managers to determine the size and position ofthe components they contain. Borders affect the layout of Swing GUIs by makingSwing components larger. You can also use invisible components to affect layout.Event handling Event handling is how programs respond to external events, such asthe user pressing a mouse button. Swing programs perform all their painting andevent handling in the event-dispatching thread.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 17
  17. 17. HDBMSPainting Painting means drawing the component on-screen. Although it’s easyto customize a component’s painting, most programs don’t do anything morecomplicated than customizing a component’s border.Threads and swingIf you do something to a visible component that might depend on or affect its state,then you need to do it from the event-dispatching thread. This isn’t an issue for manysimple programs, which generally refer to components only in event-handling code.However, other programs need to use the invoke Later method to execute component-related calls in the event-dispatching thread.Pluggable Look-and-Feel This feature enables the user to switch the look-and-feel of Swingcomponents without restarting the application. The Swing library supports a cross-platform look-and-feel – that remains the same across all platforms wherever theprogram runs. The native look-and-feel is native to whatever particular system thatthe program happens to be running, including Windows and Motif. The Swing libraryprovides an API that gives great flexibility in determining the look-and-feel ofapplications. It also enables you to create your own look-and-feelDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 18
  18. 18. HDBMSSwing Architecture Swing is built on the base of the AWT classes., but not on the AWTUI component classes. Where there are equivalent classes in each toolkit for aparticular UI component, the swing version should be used. Application Code JFC Java 2D Swing AWT Drag and Drop AccessibilityPackages The Swing component toolkit consists of over 250 pure Java classesand 75 interfaces contained in more than 10 packages. It is used to build lightweightand user interface. Swing consists of non-user interface (non-UI) classes as well as morefamiliar user-interface (UI) classes. They do not display anything on screen.Examples of non UI Swing classes are the events fired by Swing components and theSwing data model classes. The UI classes such as buttons and labels create visiblecomponents that applications can display on screen, and they can be combined tocreate a complete graphical user interface. The Swing UI components descend fromthe J-component class, and all begin with the capital letter JDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 19
  19. 19. HDBMS The Swing component classes are given below. Class Description AbstractButton Abstract superclass for Swing buttons Button group Encapsulates a mutually exclusive set of buttons ImageIcon Encapsulates an icon JApplet The Swing version of APPLET JButton The Swing push button class JCheckBox The Swing check box class JComboBox Encapsulates a combo box JLabel The Swing version of a label JRadioButton The Swing version of a button JScrollPane Encapsulates a scrollable window JTabbed pane Encapsulates a tabbed window JTable Encapsulates a table-based control JTextField The Swing version of a text field JTree Encapsulates a tree-based control Basics of Networking In its most basic form, a computer network is simply two computers thatcommunicate with each other. Of course, most networks consist of more than twocomputers. But the principles of network communication are the same for two, threeor even thousand computers. Networks usually fall into one of the two groups: local area networks andwide area networks. A local area network (LAN) connects computers located neareach other. In contrast, wide area networks (WANs) consist if computers in differentcities, states or even countries. When we connect two or more computers so that theycan communicate, we form a network. And when we connect two or more networksDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 20
  20. 20. HDBMSwe form an Internet work or Internet. The Internet is the largest and most widelyknown Inter network in the world. To perform data transfers, networks use communication switching.Communication switching lets hardware devices share physical lines ofcommunication. The two common methods of communication switching are circuitswitching and packet switching. Circuit switching creates a single unbroken path between two devices thatwant to communicate. While these devices talk, no other devices can use this path.However when the two devices finish talking, they release the communication path sothat other devices can use it. Most modern networks, including the Internet use packet switching. In fact,we can refer to the Internet as a packet-switched network. In a packet switchednetwork, programs break data into pieces called packets and transmit them betweenmany computers. Data can travel in both directions. As such each packet must carryits destination address.Servers and Clients The whole point of a network is to allow two machines to connect andcommunicate with each other. In client server applications, the server provides someservice, such as file transfer, processing database queries etc. The client uses theservice provided by the server, by displaying the results to the user. Thecommunication that occurs between the client and the server must be reliable. That is,no data can be dropped and must arrive on the client side in the same order, in whichthe server sent it. TCP provides a reliable, point-to-point communication channel that theclient-server applications on the Internet use to communicate with each other. Tocommunicate over TCP, a client program and a server program establish a connectionto one another. Each socket binds a socket to its end of the connection. Tocommunicate, the client and the server each reads from and writes to the socketbound to the connection.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 21
  21. 21. HDBMSA Network Server Class In the socket networking model, the server side has to read from orwrite to many sockets that are connected to many clients. Threading on the serverside has an additional benefit: by having a thread associated with each client, we nolonger need to worry about other clients within any single thread. This simplifies ourserver-side programming: we can code our classes as if we were handling a singleclient at a time.. The server-side socket setup is implemented in two steps. First, asocket is used for the purpose of listening on a port known to the client. The clientconnects to this port as a means to negotiate a private connection to the server.Network connections between clients and serverDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 22
  22. 22. HDBMS Once a data connection has been negotiated, the serverand client then communicate through this private connection. In general, this processis generic: most programmers are concerned with the data sockets (the privateconnection). Furthermore, the data sockets on the server side are usually selfcontained to a particular client. While it is possible to have different mechanisms thatdeal with many data sockets at the same time, generally the same code is used to dealwith each of the data sockets independently of the other data sockets. Since the setup is generic, we can place it into a generic TCPServerclass and not have to implement the generic code again. Basically, this TCPServerclass creates a ServerSocket and accepts connection requests from clients. This isdone in a separate thread. Once a connection is made, the server clones (makes a copyof) itself so that it may handle the new client connection in a new thread.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 23
  23. 23. HDBMS4.MODULES IN SOFTWARE4.1HDMS ADMINISTRATOR • Recording Server DSN details Details of the DSNs in the server are stored .Details include name,type of DSN.Only these DSNs are exported and imported by the client. • Change Administrator password This option helps the administrator for changing his password frequently. It is recommended by us to change the password frequently for increasing the of the system. • Registering new users Administrator register new users.They will be given permission to access the software. • Change User passwords This option helps the administrator for changing users password.It is necessary to change the password frequently for increasing the security of the system. • View ,Edit User profile Administrator can view users profile and can change the details if required. • Delete User Administrator deletes particular user if required. • Handling User Complaints Administrator deals with open complaints and closed complaints.Closed complaints are given by registered user,for example ,if they cannot execute some queries etc.Open complaints are given by users who are not registered ,like cannot login etc. • Setting User Permissions Allow the administrator to view and set the permissions for the user. Read Only -Users who have read Only access to the databases. Read and Write -Users who have read and write access to the databases. All -Users who are having all permissions. That is he can perform any type of operations on a database.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 24
  24. 24. HDBMS • View users currently logged in. Show the list of all the users, who are currently logged in to the system.4.2 HDMS CLIENT • Login The way by which, only the authorized users are allowed to access the system. It checks the username and password from the table and allows only authorized users inside. Login check is having a major role in this system, since security is a consideration as all databases are open in front of the user. This has a direct interaction with administrator since he is the one who has to monitor what are the permissions of a particular user. The processing is done; the username and password is checked from the database and if the check is successful then the user is allowed in. • Query Analyzer The query analyzer is the feature that allows the user to execute any type of query he/she wants. The solid responsibility of this component is to allow any type of query the user executes. The query should be according to the standard format of the query, and then only the execution will be proper. This is the main part of the application since getting the result for any type query is what the user need. The user will be able to select the dsn and the table from a combo box provided and can get the fields of the table too.This feature need the resources like DSN and table lists which should be provided by the data manager with accordance to the permission he is set with.The user gives the query, the permission is checked and if it is ok then the query will be executed and the output is given. • Export Tables The tables from the local machine is transferred to the server and hence to the any other local systems. It should allow the export of any table in any database to the server whenever the user wants. This exporting will be only possible if theDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 25
  25. 25. HDBMS user is having permissions for it. This is used for transferring the table to the server machine. Perfect GUI is provided so the whole process will look simple in the users point of view. The user will select the table to export, also he/she can do it in two ways, one, only the skeleton of the table is exported and in the other both the skeleton and data are exported. • Import Tables The tables from the server machine are transferred to the local machine. It should allow the import of any table in any database to the server whenever the user wants. This importing will be only possible if the user is having permissions for it. This is used for getting the table from the server machine. Perfect GUI is provided so the whole process will look simple in the users point of view. The user will select the table to import, also he/she can do it in two ways, one, only the skeleton of the table is imported and in the other both the skeleton and the data are imported. • Database Conversion This facilitates conversion of one database to another.For example we can convert a MS ACCESS database to Oracle and so on. • Change passwords,view profile This option helps the user for changing his/her password. It is recommended by us to change the password frequently for increasing the security of the system.User can also view his profile. • Posting Complaints Give the user an extra support for clearing his doubts. If there is a doubt for the user he can type his doubt in the Complaint Box, and press the send button. The complaint will be send to the server and the solution for that complaint will be send back by the server.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 26
  26. 26. HDBMS5. DATA FLOW DIAGRAM Understand the data flow in a system in a neat diagrammatic manner.There are standard symbols to draw DFD. Some of the important symbols that we useare:External Entity: This denotes the external entity of a considered system. These arethose entities to the software system and interact with the system by in putting data tothe system or consuming data produced by the system.Process: This denotes a particular process in the system.Data Store: This denotes a database or any type of data store in a system. This isneeded when our system stores some information in a database.Output: This denotes the output from the systemDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 27
  27. 27. HDBMSData Flow: The headed arrow represents the data flow in a system. This is normallylabeled to show what data is flowing from one process to another.Figure illustrates the data flow in a REAL TIME NETWORK MONITORINGSYSTEM.5.1 LEVEL 0 DFD Client (1) (2) Looking Query Data ; for data store Retrieving data Distributed Response Database Managemen Gets requests Updates data Data Manager (Server)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 28
  28. 28. HDBMS5.2 LEVEL 1 DFD query analyzer Server database Data Query Giving result for the Client query from the server Query Analyzing and retrieving result from Result from Query the server client analyzer database Table name Analyzing and type of Query and database retrieving result from the client Identifying database Query where the table Query is- server or Data client Client databaseDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 29
  29. 29. HDBMS5.3 LEVEL 1 DFD TABLE EXPORT Client database Client Looking for data Retrieving Data the data Getting the Messages table and columns to export Details Identifying to which Sending the data database the table has to Server be exported activity Server response Table name and data Insertion response Inserting the Data inserting Server database data into the specified database ResponseDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 30
  30. 30. HDBMS5.4 LEVEL 1 DFD TABLE IMPORT Data being stored in the corresponding Data to be stored database Client Data Table name Data to database Importing Table Client database Specifies the database, table, fields to server Data DB and table name Looking for Checks the table database and DB where particular returns data table is found Retrieving data Server DB and table nameDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 31
  31. 31. HDBMS5.4 LEVEL 2 DFD Server login file Looking for entry Client login database Result Username Looking for Client and Login entry password check Into the Password database Login success Server Server Client process User process details New Table user detail creation s Query Import tables Change database Export Query tables analyzer Checking Query for entry Into the database Result Client db To the server Query database Retrieving result Server databaseDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 32
  32. 32. HDBMS6. CODING6.1 MAIN FUNCTIONSimport java.io.*;import java.rmi.*;import java.rmi.server.*;import java.sql.*;import java.util.*;import javax.swing.*;import javax.swing.table.DefaultTableModel;import javax.swing.table.TableModel;import java.sql.ResultSetMetaData;import java.util.Vector;class imple extends UnicastRemoteObject implements inter{ imple() throws RemoteException { }public boolean login(String user,String pass,String ip) throws RemoteException { System.out.println("User Name and Pass is "+user+pass); try { FileOutputStream f=new FileOutputStream("userlist.txt",true); f.write((ip+"n").getBytes()); f.close(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connectioncon=DriverManager.getConnection("jdbc:odbc:proj"); Statement smt=con.createStatement(); String qry; qry="select user,pass from user whereuser="+user+"and pass="+pass+""; System.out.println(qry); ResultSet rs=smt.executeQuery(qry); while (rs.next()) {DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 33
  33. 33. HDBMS System.out.println("login sucessfull"); return(true); } } catch(Exception c) { System.out.println(c); } return(false); } public String[] getIp() throws RemoteException { String s=""; String ips[]=new String[10]; int i=0; try { FileReader ff=new FileReader("userlist.txt"); BufferedReader rd=new BufferedReader(ff); s=rd.readLine(); ips[i]=s; while (s!=null) { i++; System.out.println(s); s=rd.readLine(); ips[i]=s; } ff.close(); } catch(Exception ex) { System.out.println(ex); } return(ips); }DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 34
  34. 34. HDBMS public String[] getDSN()throws RemoteException { String s1=""; String gdsn[]=new String[50]; int j=0; try { Runtime r=Runtime.getRuntime(); Process pr=r.exec("dsn.exe"); FileReader f=new FileReader("DSN.txt"); BufferedReader b=new BufferedReader(f); s1= b.readLine(); s1=s1.replace(""",""); gdsn[j]=s1; while (s1!=null) { j++; System.out.println(s1); s1=b.readLine(); if (s1.startsWith(""")) { break; } gdsn[j]=s1; } f.close(); } catch(Exception exc) { System.out.println(exc); } return(gdsn); } public String[] getTables(String dsn) throws RemoteException { String str; String gt[]=new String[40]; System.out.println("DSN IS....... "+dsn); int m=0; try { System.out.println("DSN IS in block"+dsn);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 35
  35. 35. HDBMS Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("DSN IS in block"+dsn); Connectioncon=DriverManager.getConnection("jdbc:odbc:"+dsn); System.out.println("DSN IS in block"+dsn); DatabaseMetaData dm=con.getMetaData(); int i=0; ResultSet rs=dm.getTables(null,null,null,new String[]{"TABLE"}); while (rs.next()) { str=rs.getString(3); gt[i]=str; i++; } }catch(Exception e) { System.out.println("Error at getTables :Error "+e); } return(gt); } public Vector[] importtable(String dsn,String table) { Vector v[]=new Vector[2]; v[0]=new Vector(); v[1]=new Vector(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connectioncon=DriverManager.getConnection("jdbc:odbc:"+dsn); Statement s=con.createStatement(); ResultSet rs=s.executeQuery("select * from "+table); ResultSetMetaData rm=rs.getMetaData(); int colcount=rm.getColumnCount(); int flag[]=new int[colcount]; String cname,ctype,str=""; int csize; for(int i=1;i<=colcount;i++)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 36
  36. 36. HDBMS { cname=rm.getColumnName(i); ctype=rm.getColumnTypeName(i); csize=rm.getColumnDisplaySize(i); if(cname.equalsIgnoreCase("user")) { cname="user1"; } if (!ctype.equalsIgnoreCase("INTEGER")) { str=cname+" "+ctype+" "+"("+csize+")"; } else { str=cname+" "+ctype; } v[0].addElement(str); str=""; } String st=""; rs.close(); rs=s.executeQuery("select * from "+table); while (rs.next()) { for(int j=1;j<=colcount;j++) { st=st+""+rs.getString(j)+""+","; } st=st.substring(0,st.lastIndexOf(",")); System.out.println(st); v[1].addElement(st); st=""; } } catch(Exception im) { System.out.println("In get table datas"+im); } return v;DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 37
  37. 37. HDBMS } public JTable QueryAnalyzer(String dsn,Stringtable,String Query) { JTable t; String st; int l; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connectioncon=DriverManager.getConnection("jdbc:odbc:"+dsn); Statement s=con.createStatement(); ResultSet rs; l=Query.indexOf(" "); st=Query.substring(0,l); System.out.println(st); if (!st.equalsIgnoreCase("select")) { s.executeUpdate(Query); } con.close(); Connectionconn=DriverManager.getConnection("jdbc:odbc:"+dsn); Statement stt=conn.createStatement(); rs=stt.executeQuery("select * from "+table); ResultSetMetaData metaData=rs.getMetaData(); int numberOfColumns = metaData.getColumnCount(); Vector columnNames = new Vector(); for(int column = 0; column < numberOfColumns;column++) { columnNames.addElement(metaData.getColumnLabel(column + 1)); } Vector rows = new Vector(); while (rs.next()) { Vector newRow = new Vector(); for(int i = 1; i <= numberOfColumns; i++)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 38
  38. 38. HDBMS { newRow.addElement(rs.getObject(i)); } rows.addElement(newRow); } DefaultTableModel m=new DefaultTableModel(rows,columnNames); t= new JTable(m); return(t); } catch (Exception e) { t=new JTable(); e.printStackTrace(); return(t); } } //logout public boolean exit(String ip) throws RemoteException { String s; String ips[]=new String[20]; String ips1[]=new String[20]; try { FileReader rd=new FileReader("userlist.txt"); BufferedReader b=new BufferedReader(rd); s=b.readLine(); int i=0; while (s!=null) { //System.out.println(s); ips[i]=s; s=b.readLine(); i++;DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 39
  39. 39. HDBMS } //String ip="192.168.10.16"; int x=0; for(int j=0;j<i;j++) { s=ips[j]; if (s.equals(ip)) { continue; } System.out.println(s); ips1[x]=s; x++; } FileOutputStream out=new FileOutputStream("userlist.txt"); for(int j=0;j<x;j++) { out.write((ips1[j]+"n").getBytes()); } return(true); } catch(Exception ex) { System.out.println(ex); return(false); } } //export table public boolean exporttable(String dsn,String table,Vector[] v) {String ss="";try{DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 40
  40. 40. HDBMS for(int i=0;i<v[0].size();i++) { ss=ss+v[0].elementAt(i)+","; } Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:"+dsn); Statement s=con.createStatement(); ss=ss.substring(0,ss.lastIndexOf(",")); if (table.equalsIgnoreCase("user")) { table="user1"; } ss="create table "+table+"("+ss+")"; System.out.println(ss); s.executeUpdate(ss); String qry; for(int i=0;i<v[1].size();i++) { qry="insert into "+table+" values("; qry=qry+v[1].elementAt(i)+")"; System.out.println(qry); s.executeUpdate(qry); } } catch(Exception ex) {System.out.println(ex+"here in exporttab"); }return(true); } public boolean update(String user,String data) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:proj"); Statement s=con.createStatement(); s.executeUpdate("update user set priv="+data+"where user="+user+""); JOptionPane.showMessageDialog(null," User Database Updated","DDBMS",1); return(true);// System.out.println("gh");DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 41
  41. 41. HDBMS } catch(Exception e) { System.out.println(e); return(false); }}}6.2 QUERY ANALYZERimport java.rmi.*;import java.io.*;import javax.swing.*;import java.util.*;import java.awt.event.*;import java.sql.*;import java.net.*;import javax.swing.table.TableModel;class queryanalyzer implements ActionListener,ItemListener{ JFrame frame; JLabel lb1; JLabel lb2; JLabel lb3; JLabel lb4; JLabel lb5; JComboBox cb1; JComboBox cb2; JComboBox cb3; JComboBox cb4; JTextField tf; JButton b1; JButton b2; JPanel pan; JTable tab; JFrame fr; JPanel pp; JScrollPane JSP; queryanalyzer(String ser)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 42
  42. 42. HDBMS { frame=new JFrame("QueryAnalyzer"); pan=new JPanel(); pan.setLayout(null); lb1=new JLabel("Remote system"); lb1.setBounds(15,20,100,60); pan.add(lb1); cb1=new JComboBox(); cb1.setBounds(130,40,150,20); pan.add(cb1); lb2=new JLabel("Remote DSN"); lb2.setBounds(15,80,100,20); pan.add(lb2); cb2=new JComboBox(); cb2.setBounds(130,80,150,20); pan.add(cb2); lb3=new JLabel("Remote Table"); lb3.setBounds(15,120,200,20); pan.add(lb3); cb3=new JComboBox(); cb3.setBounds(130,120,150,20); pan.add(cb3); lb4=new JLabel("Query"); lb4.setBounds(550,10,120,60); pan.add(lb4); tf=new JTextField(); tf.setBounds(300,60,480,30); pan.add(tf); b1=new JButton("Execute"); b1.setBounds(400,105,120,30); pan.add(b1); b2=new JButton("Cancel"); b2.setBounds(580,105,120,30); pan.add(b2);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 43
  43. 43. HDBMS frame.add(pan); frame.setBounds(150,50,800,380); //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.show(); fr=new JFrame("Table"); pp=new JPanel(); pp.setLayout(null); cb1.addItemListener(this); cb2.addItemListener(this); b1.addActionListener(this); b2.addActionListener(this); try { inter i=(inter)Naming.lookup("rmi://"+ser+"/register"); String ips[]; ips=new String[20]; ips=i.getIp(); int j=0; while (ips[j]!=null) { cb1.addItem(ips[j++]); } } catch(Exception e) { System.out.println(e); } try { String s1; Runtime r=Runtime.getRuntime(); Process pr=r.exec("dsn.exe"); FileReader f=new FileReader("DSN.txt"); BufferedReader b=new BufferedReader(f); s1= b.readLine(); s1.trim();DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 44
  44. 44. HDBMS int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length()); while (s1!=null) { cb4.addItem(s1); s1=b.readLine(); if(s1.equals(""")) { break; } } f.close(); } catch(Exception ab) { System.out.println(ab); } } public void itemStateChanged(ItemEvent ie) { if (ie.getSource()==cb1) { cb2.removeAllItems(); String s1; String gdsn[]; gdsn=new String[20]; try { inter g=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); gdsn=g.getDSN(); int k=0; s1=gdsn[k]; s1.trim(); int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length());DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 45
  45. 45. HDBMS while (s1!=null) { cb2.addItem(s1); k++; s1=gdsn[k]; if(s1.equals(""")) { break; } } } catch(Exception a) { System.out.println(a); } } if (ie.getSource()==cb2) { cb3.removeAllItems(); String s2; String gt[]; gt=new String[25]; try { inter t=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); String dsn; dsn=""+cb2.getSelectedItem(); dsn.trim(); int p; p=dsn.indexOf("("); dsn=dsn.substring(0,p-1); System.out.println("This is the "+dsn) ; gt=t.getTables(dsn); int m=0; s2=gt[m]; while (s2!=null) { cb3.addItem(s2); m++; s2=gt[m]; }DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 46
  46. 46. HDBMS } catch(Exception ab) { System.out.println(ab+"efgf"); } } } public void actionPerformed(ActionEvent e) { if (e.getSource()==b1) { String dsn,table,Query; JTable tb; tb=new JTable(); table=""+cb3.getSelectedItem(); Query=tf.getText(); dsn=""+cb2.getSelectedItem(); dsn.trim(); int p; p=dsn.indexOf("("); dsn=dsn.substring(0,p-1); try { inter t=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); tb=t.QueryAnalyzer(dsn,table,Query); fr.setBounds(300,150,310,310); JSP=new JScrollPane(tb); JSP.setBounds(10,10,290,290); pp.add(JSP); fr.add(pp); fr.setVisible(true);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 47
  47. 47. HDBMS frame.dispose(); } catch(Exception n) { System.out.println(n+"error1"); } } if (e.getSource()==b2) { frame.show(); } }}6.3 IMPORTING TABLESimport java.io.*;import javax.swing.*;import java.awt.event.*;import java.rmi.*;import java.util.*;import java.sql.*;class exports implements ActionListener,ItemListener{ JFrame frame; JLabel lb1;DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 48
  48. 48. HDBMS JLabel lb2; JLabel lb3; JLabel lb4; JComboBox cb1; JComboBox cb2; JComboBox cb3; JComboBox cb4; JButton b1; JButton b2; JList list; String ser; exports(String ser1) { ser=ser1; frame=new JFrame("Export"); JPanel pan=new JPanel(); pan.setLayout(null); lb1=new JLabel("Remote System"); lb1.setBounds(15,20,100,60); pan.add(lb1); cb1=new JComboBox(); cb1.setBounds(130,40,150,20); pan.add(cb1); lb2=new JLabel(" Remote DSN"); lb2.setBounds(15,80,100,20); pan.add(lb2);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 49
  49. 49. HDBMS cb2=new JComboBox(); cb2.setBounds(130,80,150,20); pan.add(cb2); lb3=new JLabel("DSN"); lb3.setBounds(15,155,200,20); pan.add(lb3); cb3=new JComboBox(); cb3.setBounds(130,155,150,20); pan.add(cb3); lb4=new JLabel("Table"); lb4.setBounds(15,185,100,60); pan.add(lb4); cb4=new JComboBox(); cb4.setBounds(130,200,150,20); pan.add(cb4); b1=new JButton("Export"); b1.setBounds(100,280,80,30); pan.add(b1); b2=new JButton("Cancel"); b2.setBounds(200,280,80,30); pan.add(b2); frame.add(pan);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 50
  50. 50. HDBMS frame.setBounds(300,50,500,420); frame.show(); b1.addActionListener(this); cb1.addItemListener(this); cb3.addItemListener(this); b2.addActionListener(this); try { inter i=(inter)Naming.lookup("rmi://"+ser+"/register"); String ips[]; ips=new String[20]; ips=i.getIp(); int j=0; while (ips[j]!=null) { cb1.addItem(ips[j++]); } } catch(Exception e) { System.out.println(e); }DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 51
  51. 51. HDBMS try { String s1; Runtime r=Runtime.getRuntime(); Process pr=r.exec("dsn.exe"); FileReader f=new FileReader("DSN.txt"); BufferedReader b=new BufferedReader(f); s1= b.readLine(); s1.trim(); int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length()); while (s1!=null) { cb3.addItem(s1); s1=b.readLine(); if(s1.equals(""")) { break; } } f.close(); } catch(Exception ab) { System.out.println(ab); }DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 52
  52. 52. HDBMS } public void itemStateChanged(ItemEvent ie) { if (ie.getSource()==cb1) { cb2.removeAllItems(); String s1; String gdsn[]; gdsn=new String[20]; try { inter g=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); gdsn=g.getDSN(); int k=0; s1=gdsn[k]; s1.trim(); int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length()); while (s1!=null) { cb2.addItem(s1); k++; s1=gdsn[k]; if(s1.equals("""))DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 53
  53. 53. HDBMS { break; } } } catch(Exception a) { System.out.println(a); } } if (ie.getSource()==cb3) { cb4.removeAllItems(); String s2; String gt[]; gt=new String[25]; try { String dsn,str; dsn=""+cb3.getSelectedItem(); dsn.trim(); int p; p=dsn.indexOf("("); dsn=dsn.substring(0,p-1); System.out.println("This is the "+dsn);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 54
  54. 54. HDBMS Connectioncon=DriverManager.getConnection("jdbc:odbc:"+dsn); System.out.println("DSN IS in block"+dsn); DatabaseMetaData dm=con.getMetaData(); int i=0; ResultSet rs=dm.getTables(null,null,null,new String[]{"TABLE"}); while (rs.next()) { str=rs.getString(3); gt[i]=str; i++; } int m=0; s2=gt[m]; while (s2!=null) { cb4.addItem(s2); m++; s2=gt[m]; } } catch(Exception ab) { System.out.println(ab);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 55
  55. 55. HDBMS } } } public void actionPerformed(ActionEvent ae) { if (ae.getSource()==b2) { frame.dispose(); } if (ae.getSource()==b1) { String dsn,table; try { dsn=""+cb3.getSelectedItem(); dsn.trim(); dsn=dsn.substring(0,dsn.indexOf("(")-1); table=""+cb4.getSelectedItem(); Vector v[]=new Vector[2]; v[0]=new Vector(); v[1]=new Vector(); inter in=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 56
  56. 56. HDBMS Connectioncon=DriverManager.getConnection("jdbc:odbc:"+dsn); Statement s=con.createStatement(); ResultSet rs=s.executeQuery("select * from "+table); ResultSetMetaData rm=rs.getMetaData(); int colcount=rm.getColumnCount(); int flag[]=new int[colcount]; String cname,ctype,str=""; int csize; for(int i=1;i<=colcount;i++) { cname=rm.getColumnName(i); ctype=rm.getColumnTypeName(i); csize=rm.getColumnDisplaySize(i); if(cname.equalsIgnoreCase("user")) { cname="user1"; } if (!ctype.equalsIgnoreCase("INTEGER")) { str=cname+" "+ctype+" "+"("+csize+")"; } else { str=cname+" "+ctype; } v[0].addElement(str); str="";DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 57
  57. 57. HDBMS } String st=""; rs.close(); rs=s.executeQuery("select * from "+table); while (rs.next()) { for(int j=1;j<=colcount;j++) { st=st+""+rs.getString(j)+""+","; } st=st.substring(0,st.lastIndexOf(",")); System.out.println(st); v[1].addElement(st); st=""; } boolean b;String ds; ds=""+cb2.getSelectedItem(); ds.trim(); ds=ds.substring(0,ds.indexOf("(")-1); b=in.exporttable(ds,table,v); if (b) { JOptionPane.showMessageDialog(null," Table Exported","DDBMS",1); } else { JOptionPane.showMessageDialog(null," Faildd to Export"); }DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 58
  58. 58. HDBMS } catch(Exception exe) { System.out.println(exe); } } }}6.4 EXPORTING TABLESimport java.rmi.*;import java.io.*;import javax.swing.*;import java.util.*;import java.awt.event.*;import java.sql.*;class imports implements ItemListener,ActionListener{ JFrame frame; JLabel lb1; JLabel lb2; JLabel lb3; JLabel lb4; JLabel lb5; JComboBox cb1; JComboBox cb2;DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 59
  59. 59. HDBMS JComboBox cb3; JComboBox cb4; JTextField tf; JButton b1; JButton b2; imports(String ser) { frame=new JFrame("Import"); JPanel pan=new JPanel(); pan.setLayout(null); lb1=new JLabel("Remote system"); lb1.setBounds(15,20,100,60); pan.add(lb1); cb1=new JComboBox(); cb1.setBounds(130,40,150,20); pan.add(cb1); lb2=new JLabel("Remote DSN"); lb2.setBounds(15,80,100,20); pan.add(lb2); cb2=new JComboBox(); cb2.setBounds(130,80,150,20); pan.add(cb2); lb3=new JLabel("Remote Table"); lb3.setBounds(15,120,200,20); pan.add(lb3);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 60
  60. 60. HDBMS cb3=new JComboBox(); cb3.setBounds(130,120,150,20); pan.add(cb3); lb4=new JLabel("DSN"); lb4.setBounds(15,185,100,60); pan.add(lb4); cb4=new JComboBox(); cb4.setBounds(130,200,150,20); pan.add(cb4); lb5=new JLabel("Table"); lb5.setBounds(15,220,100,60); pan.add(lb5); tf=new JTextField(); tf.setBounds(130,240,150,20); pan.add(tf); b1=new JButton("Import"); b1.setBounds(70,300,80,30); pan.add(b1); b2=new JButton("Cancel"); b2.setBounds(170,300,80,30); pan.add(b2); frame.add(pan); frame.setBounds(400,50,330,380);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 61
  61. 61. HDBMS frame.show(); cb1.addItemListener(this); cb2.addItemListener(this); b1.addActionListener(this); b2.addActionListener(this); try { inter i=(inter)Naming.lookup("rmi://"+ser+"/register"); String ips[]; ips=new String[20]; ips=i.getIp(); int j=0; while (ips[j]!=null) { cb1.addItem(ips[j++]); } } catch(Exception e) { System.out.println(e); } try { String s1; Runtime r=Runtime.getRuntime(); Process pr=r.exec("dsn.exe");DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 62
  62. 62. HDBMS FileReader f=new FileReader("DSN.txt"); BufferedReader b=new BufferedReader(f); s1= b.readLine(); s1.trim(); int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length()); while (s1!=null) { cb4.addItem(s1); s1=b.readLine(); if(s1.equals(""")) { break; } } f.close(); } catch(Exception ab) { System.out.println(ab); } } public void itemStateChanged(ItemEvent ie) {DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 63
  63. 63. HDBMS if (ie.getSource()==cb1) { cb2.removeAllItems(); String s1; String gdsn[]; gdsn=new String[20]; try { inter g=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); gdsn=g.getDSN(); int k=0; s1=gdsn[k]; s1.trim(); int pos; pos=s1.indexOf("""); s1=s1.substring(pos+1,s1.length()); while (s1!=null) { cb2.addItem(s1); k++; s1=gdsn[k]; if(s1.equals(""")) { break; } } } catch(Exception a)DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 64
  64. 64. HDBMS { System.out.println(a); } } if (ie.getSource()==cb2) { cb3.removeAllItems(); String s2; String gt[]; gt=new String[25]; try { inter t=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); String dsn; dsn=""+cb2.getSelectedItem(); dsn.trim(); int p; p=dsn.indexOf("("); dsn=dsn.substring(0,p-1); System.out.println("This is the "+dsn) ; gt=t.getTables(dsn); int m=0; s2=gt[m]; while (s2!=null) { cb3.addItem(s2);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 65
  65. 65. HDBMS m++; s2=gt[m]; } } catch(Exception ab) { System.out.println(ab+"efgf"); } } }public void actionPerformed(ActionEvent ae){ if (ae.getSource()==b2) { frame.dispose(); } if (ae.getSource()==b1) { String dsn,table,ss=""; try {dsn=""+cb2.getSelectedItem(); dsn.trim(); dsn=dsn.substring(0,dsn.indexOf("(")-1); table=""+cb3.getSelectedItem(); inter in=(inter)Naming.lookup("rmi://"+cb1.getSelectedItem()+"/register"); Vector v[]=new Vector[2]; v[0]=new Vector(); v[1]=new Vector(); v=in.importtable(dsn,table);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 66
  66. 66. HDBMS for(int i=0;i<v[0].size();i++) { ss=ss+v[0].elementAt(i)+","; } String tab,ds; ds=""+cb4.getSelectedItem(); ds.trim(); ds=ds.substring(0,ds.indexOf("(")-1); tab=tf.getText(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:"+ds); Statement s=con.createStatement(); ss=ss.substring(0,ss.lastIndexOf(",")); ss="create table "+tab+"("+ss+")"; System.out.println(ss); s.executeUpdate(ss); //s.close(); String qry; for(int i=0;i<v[1].size();i++) { qry="insert into "+tab+" values("; qry=qry+v[1].elementAt(i)+")"; System.out.println(qry); s.executeUpdate(qry);DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 67
  67. 67. HDBMS } JOptionPane.showMessageDialog(null," Table imported","DDBMS",1); } catch(Exception ex) {System.out.println(ex+"here in import"); }} }}DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 68
  68. 68. HDBMS7. DESIGN AND IMPLEMENTATION7.1 INPUT DESIGN Input design is the process of converting user inputs into computer-basedformat. Input data is collected and organized into groups of similar data. The goalbehind designing input data is to make the data entry easy and make it free fromlogical errors. Example: The input entry to all type of clients is the user name andpassword. If they are valid the client is allowed to enter into the software.OBJECTIVES  To achieve the highest possible level of accuracy.  To ensure that the input is acceptable and understandable.7.2 COMPONENT DESIGN The different types of components that come under this application are: 1. Login 2. Query Analyzer 3. Export Table 4. Import Table7.3 OUTPUT DESIGN Outputs are the most important and direct source of information to the user.Efficient and eligible output design should improve the system’s relationship with theuser and help in decision making. Output design generally deals with the resultsgenerated by the system. In this system the correct answers for the queries in the mostappropriate format. ie, to show the output of the select query in the table format andthat of an insert or create in a text area.DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 69
  69. 69. HDBMS7.4 DATABASE DESIGN The general theme behind a database is to handle information as an integratedwhole. A database is a collection of interrelated data stored with minimumredundancy to serve many users quickly and efficiently. The general objective is tomake information access easy, quick, inexpensive and flexible for the user. Theconcept behind a database is an integrated collection of data and provides acentralized access to the data from the program. While designing database, severalobjectives must be considered: Controlled Redundancy Data Independence More information at low cost Accuracy and Integrity Privacy and Security. PerformanceDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 70
  70. 70. HDBMS8. SCREENSHOTS Figure 8.1 Login page Figure 8.2 Single table importDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 71
  71. 71. HDBMS Figure 8.3 Single Export Figure 8.4 Query AnalyzerDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 72
  72. 72. HDBMS Figure 8.5 Multiple Export Figure 8.6 Multiple ImportDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 73
  73. 73. HDBMS Figure 8.7 Setting PrivillagesDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING, January 2011 74

×