Distributed Systems Lab.  It is extremely simplified application will be realized with the aid of various middleware technologies.  It allows the.

Slides:



Advertisements
Similar presentations
Lecture # 21 Chapter 6 Uptill 6.4. Type System A type system is a collection of rules for assigning type expressions to the various parts of the program.
Advertisements

Basic JDBC Celsina Bignoli What is JDBC Industry standard for database- connectivity between the Java language and a wide range of.
15-Jun-15 JDBC. JDBC is a Sun trademark It is often taken to stand for Java Database Connectivity Java is very standardized, but there are many versions.
1 JDBC Java Database Connectivity. 2 c.pdf
Ido Bercovich Dikla Mordechay Lilach Tesler Academic Advisor: Dr. Yuval Alovici Professional Advisor: Dr. Mayer Goldberg Trading Champions A Application.
Manipulating MySQL Databases with PHP. PHP and mySQL2 Objectives Connect to MySQL from PHP Learn how to handle MySQL errors Execute SQL statements with.
Java Database Connectivity JDBC ICW Lecture 12 Errol Thompson.
JDBC Overview Autumn 2001 Lecturer: C. DeJong. Relational Databases widespread use used via SQL (Structured Query Language) freely available powerful.
Objectives Connect to MySQL from PHP
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
Introduction to JDBC (Java Database Connectivity).
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
1 Java Database Connection (JDBC) There are many industrial-strength DBMS's commercially available in the market. Oracle, DB2, and Sybase are just a few.
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Java Utility Classes CS 21b. Some Java Utility Classes Vector Hashtable StringTokenizer * import java.util.*;
Distributed Systems Lab Lecture -1-.  It is extremely simplified application will be realized with the aid of various middleware technologies.  It allows.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Inner Join vs. Outer Join
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Chapter 8 Databases.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
Presentation On How To Create Connection To A Database.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
Tasks Needed for MissionMapEditor Martin Q. Zhao September 18, 2010.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
Web Programming MySql JDBC Web Programming.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
SQL and Java The vision for Java is to be the concrete and nails that people use to build this incredible network system that is happening all around us.
1 JDBC – Java Database Connectivity CS , Spring 2010.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Visual Database Creation with MySQL Workbench 도시정보시스템 설계
Database Processing with JSP ISYS 350. Database Applications Applications Database Server Queries/Updates Results.
JDBC.
Java - KFT1 Task 4 RegiStudent Diagrams
Java - KFT1 Task 4 RegiStudent Diagrams IT Java Course Mentors : - Pubali Banerjee, PhD - Cynthia Lang, PE, MSChE Western Governors University IT Java.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Database Programming Basic JDBC Programming Concepts.
CS3220 Web and Internet Programming Database Access with JDBC
JDBC – Java Database Connectivity
PL/pgSQL
CS320 Web and Internet Programming Database Access with JDBC
Advanced Web Automation Using Selenium
HW#4 Making Simple BBS Using JDBC
JDBC.
Super Market Management
Using a Database with JDBC
JDBC Example.
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Presentation transcript:

Distributed Systems Lab

 It is extremely simplified application will be realized with the aid of various middleware technologies.  It allows the retrieval of information on market prices and exchange rate developments, as well as managing the stock deposit.  The application will also allows the user to play a game during observing the prices of the stock market. ▪ such Sudoku, Zuma or else. 3 June 20163Distributed Systems Lab

 It will be MySQL database stores the companies prices in the market and users login and balance details.  The database tables will be:  CO_Name ▪ CO_ID (primary key): ID of the limited company and it is an integer. ▪ CO_NAME: String, name of the company.  CO_Data: ▪ ID (primary key): it is an integer. ▪ C_ID: ID of the company, which is integer also. ▪ DAY: we will assume that has taken place every working day trade and day as an integer number (1.. 31). ▪ SHARE_VALUE: Current share price that day and it is a double number (0.01 to EUR). 3 June 20164Distributed Systems Lab

Application Database Cont.  USER ▪ U_ID (primary key): ID of the limited company and it is an integer. ▪ U_NAME: String, name of the company. ▪ U_PSWD:  USER_TRANS: // user transaction history ▪ ID (primary key): it is an integer. ▪ C_ID: ID of the company, which is integer also. ▪ U_ID: ▪ DAY: we will assume that has taken place every working day trade and day as an integer number (1.. 31). ▪ TRANS_TYPE: ▪ AMOUNT: int amount 3 June 20165Distributed Systems Lab

 Application will be implemented as following:  ConnectDB Class  exchangeClient Class  GameClass  Note:  Interface or abstract class. Which one should you use on the project. 3 June 20166Distributed Systems Lab

 / / Constructor, loads the DB driver public ConnectDB ()  MySql DB url: jdbc:mysql://host_name:port/dbname  MySql Driver: com.mysql.jdbc.Driver  Class.forName("com.mysql.jdbc.Driver").newInstance(); //load the driver  Connection dcon = DriverManager.getConnection(DB url, “username", “password");//start a connection  / / Opens a connection to the database public boolean OpenDB ()  if(!dcon.isClosed()) // check if the connection is open  / / Closes an existing connection to the database public boolean CloseDB ()  dcon.close(); 3 June 20168Distributed Systems Lab

 / / Takes the SQL string from the open DB and return ResultSet. on error SQLException is thrown public ResultSet executeDB (String SQL) //define statement object to execute sql query Statement stat = dcon.createStatement(); //results of sql query returns in a ResultSet object ResultSet rs = stat.executeQuery("select * from table where “); if (!rs.next()) { //if no results found rs.close(); stat.close(); dcon.close(); } else { // action code }  / / Returns the error message of the last executed SQL command. if the command was successful, "OK" would be returned public String getStatus () 3 June 20169Distributed Systems Lab

exchangeClient Class  public String CreateUser(String name, String pwrd)  It returns string on success like “your account is created successfully ”, or if there is any problem during the creation such as the duplication of the user name, empty field it returns message of that problem.  public String Login (String name, String pwrd)  If there is any problem during the login process such as the name is not exist in the DB it returns message of it. Otherwise it returns welcoming message. 3 June 2016Distributed Systems Lab11

exchangeClient Class Cont.  public String [] GetAllCompanies ()  Returns a list of all Company names in an array of strings.  public double GetValue (int x, String Company)  It returns the price of the share of the Company on day X (1.. 31). When entering an invalid date and / or Company-name is not exist will return "-1.0". 3 June 2016Distributed Systems Lab12

exchangeClient Class Cont.  public double BigWinnerGain (int X, int Y)  Investigated the stock during the period between the 2 days X (1.. 30) and Y (X... 31) the largest percentage gain  With Y > X and K (X) = price at the date X has generated. The output is the percentage value of the price. 3 June 2016Distributed Systems Lab13

exchangeClient Class Cont.  public String BigWinnerCompany (int X, int Y) As the previous method, but the name of the concerned Company is returned. 3 June 2016Distributed Systems Lab14

exchangeClient Class Cont.  public double Variance (String Company) Calculates the sensitivity of the price of a given Company-Name over the entire month. First, calculate the arithmetic mean with all the prices of the share x i of n days.  The standard deviation can then be calculated from the following equation. 3 June 2016Distributed Systems Lab16

exchangeClient Class Cont.  public int Tendency (int X1) Sums the overall performance by all the companies on a given day X1 (1.. 30). The same happens for the following day X2 = X1 +1. The trend is as Integer value returned from the following equations: 0 - strongly positive (Sum X2 > Sum X ) 1 - positive (Sum X2 > Sum X1 + 80) AND (Sum X2 ≤ Sum X1 +250) 2 - neutral (Sum X2 > Sum X1 - 80) AND (Sum X2 ≤ Sum X1 +80) 3 - negative (Sum X2 > Sum X1 -250) AND (Sum X2 ≤ Sum X1 -80) 4 - strongly negative (Sum X2 < Sum X1 -250) 3 June 2016Distributed Systems Lab17

exchangeClient Class Cont.  public boolean Buy ( String Company, int amount ) * Buy a quantity of shares of a corporation at the current rate on 31 Day. Upon successful transaction, it returns true, otherwise false.  public void Sell (String Company, int amount) * Selling a set M of shares of a corporation at the current rate on 31 Day. Upon successful transaction, it returns true, otherwise false. 3 June 2016Distributed Systems Lab18

exchangeClient Class Cont.  public int StockAmount (String CO) * Returns the number of the shares of the Company CO, which one has in its custody.  public double StockValue (String CO) * Returns the value of the shares of the Company CO, which one has in its custody. By the price of 31 Day is used. 3 June 2016Distributed Systems Lab19

 These guides to help you implementing your project.  You can add or edit if you think it convenient to your project in which you will mention it in your report. 3 June Distributed Systems Lab

  y.html?article= &page=1 3 June Distributed Systems Lab