FAULT TOLERANT BANKING SYSTEM OVERVIEW Project Goal Project Description Project Structure Test Cases Screenshots PROJECT GOAL This is a scenario where a user requests a transaction to the bank database server. During this transaction, if there is an error like database server suddenly stops responding. Then, to provide the service to the customer with out any interference even if the server is down is the main goal of this Fault Tolerant Banking System. PROJECT DESCRIPTION This project handles the situation where a user requests for a transaction to the Bank Database server, while the database is down. This is done by using two databases which are replicated. That is, when one database is down we connect the request to the other database and provide the service to the user without any interruption or fault. PROJECT STRUCTURE Firstly, I create two databases and replicated the data in them. After replicating, I created a JSP page which consists of a HTML form which takes the data from user and passes those parameter correspondingly. From Main page we move on to other JSP pages (withdraw, deposit, check balance) where we process the transaction as user requested. Created some other JSP pages which handle the exception in the code like if one database is down We throw an exception and handle it in the exception handler page by connecting to other database complete the transaction. TEST CASES The Main page consists a part of code which syncs the two databases every time when an update is done to one of the tables. Class.forName("oracle.jdbc.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:rani","system","usha"); Statement stm=null; String rec="select * from customer minus select * from customer@link2"; Statement stmt2=null; stmt2=con.createStatement(); Statement stm2=conn.createStatement(); int mod1= stm2.executeUpdate(re); int mod=stmt2.executeUpdate(rec); if(mod==1) { String rec1="update rani.customer set rani.customer.amount=orcl.customer.amount where rani.customer.acc_no=orcl.customer.acc_no "; stmt=conn.createStatement(); stmt.executeUpdate(rec1); } if(mod1==1) { String rec1="update orcl.customer set orcl.customer.amount=rani.customer.amount where orcl.customer.acc_no=rani.customer.acc_no "; stmt=con.createStatement(); stmt.executeUpdate(rec1); } %> TEST CASES: If during an operation, one of the database does not respond then we check whether the other database is used for further processing of operation or transaction. <%@ page isErrorPage="true" import="java.io.*" %> <%@page language="java" import="java.lang.*" import="java.sql.*" import="java.math.*"%> <html> <head> <title> </title> <style type="text/css"> body, p { font-family:Tahoma; font-size:10pt; padding-left:30; } pre { font-size:8pt; } </style> </head> <body> <% String str=request.getParameter("r1"); String account_no_1=request.getParameter("account_no"); int ID2=Integer.parseInt(account_no_1); String amount_1=request.getParameter("amount"); int ID=Integer.parseInt(amount_1); Class.forName("oracle.jdbc.OracleDriver"); Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:rani","system","usha"); String rec="Update customer set amount= amount + "+ID+" where acc_no='"+ID2+"'"; Statement stmt=con.createStatement(); int mod=stmt.executeUpdate(rec); if(mod==1) { %> <script type="text/JavaScript"> alert("Deposit Completed Successfully"); document.write('account number:', +account_no_1,'updated with amount:', +id,'currently the balance in the account is:', +amount); </script> <%}%> <% con.commit(); stmt.close(); con.close(); %> SCREENSHOTS SCREENSHOT FOR DEPOSIT SCREENSHOT FOR BALANCE CHECK SCREENSHOT FOR WITHDRAW SCREENSHOT BEFORE UPDATION IS DONE SCREENSHOT AFTER DEPOSIT IS DONE SCREENSHOT AFTER WITHDRAW