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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

19-Jun-15 SQL. SQL is Structured Query Language Some people pronounce SQL as “sequel” Other people insist that only “ess-cue-ell” is the only correct.
1 Design patterns Lecture 4. 2 Three Important skills Understanding OO methodology Mastering Java language constructs Recognizing common problems and.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Java MS Access database connectivity Follow these steps: 1)Go to the start->Control Panel->Administrative Tools- > data sources. 2)Click Add button and.
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
INTERNET APPLICATION DEVELOPMENT For More visit:
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Intro to JDBC To effectively use Java Data Base Connectivity we must understand: 1.Relational Database Management Systems (RDBMS) 2.JDBC Drivers 3.SQL.
Database Programming in Java Corresponds with Chapter 32, 33.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
Views, Indexes and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Haiman Tian 1.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
Stored Procedures, Triggers, Program Access Dr Lisa Ball 2008.
JAVA Database Access. JDBC The Java Database Connectivity (JDBC) API is the industry standard for database- independent connectivity between the Java.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
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.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
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.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2015, Fred McClurg, All Rights.
Index and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Tasks Needed for MissionMapEditor Martin Q. Zhao September 18, 2010.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
1 Download current version of Tomcat from: g/tomcat/ g/tomcat/ Install it in: C:\Program Files\Apache.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
Databases and SQL CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
Database Processing with JSP ISYS 350. Database Applications Applications Database Server Queries/Updates Results.
SQL CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
Database Programming Basic JDBC Programming Concepts.
Lec - 14.
JDBC 15-Apr-18.
CS320 Web and Internet Programming SQL and MySQL
Principles of Software Development
Advanced Web Automation Using Selenium
JDBC 21-Aug-18.
JDBC.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Client Access, Queries, Stored Procedures, JDBC
JDBC 15-Nov-18.
SQL pepper.
Tutorial 6 PHP & MySQL Li Xu
CS3220 Web and Internet Programming SQL and MySQL
MySQL Database System Installation Overview SQL summary
CS3220 Web and Internet Programming SQL and MySQL
MySQL Database System Installation Overview SQL summary
Java Chapter 6 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

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 File locking Security concerns Much more

Different SQL Servers Mysql (open source – no cost to use though may cost to embed and resell outside gpl) Ms sql (microsoft ) Oracle Sybase Access Older AS/400 – SQL machine

Structure SQL Server runs a service accepts sql commands using their version of the standard query language Allows access to the data inside the SQL server Organized into databases Tables (like spreadsheets) inside databases Gui management interface – Access / mysql workbench / mssql studio mgr

Your databases Connect with : mysql -u yourdbuser -p yourdatabase – The –p means the password will be entered later. You can also put the password right after the p as in pmypassword. No spaces and no quotes – Your database name is your db user and is usually your ecampus logon name – You should also be able to connect to pepperdb See your tables show tables See information inside your table select * from tablename

Create a table CREATE TABLE table_name (column_name column_type ); Plus insert PRIMARY KEY ( id ) at end Ex: create table tut( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(100) NOT NULL, type VARCHAR(40) NOT NULL, date DATE, PRIMARY KEY ( id ) ); Credit to :

Create a related table Create table types ( type VARCHAR(40) NOT NULL, name VARCHAR(100) NOT NULL, manager int not null, PRIMARY KEY ( type) ); Table picture from wikipedia

Insert a row INSERT INTO table_name ( field1, field2,...fieldN ) VALUES ( value1, value2,...valueN ); Examples: INSERT INTO tut ( title, type, submission_date) VALUES ("Learn PHP", "php",NOW()); INSERT INTO tut (title, type, submission_date) VALUES ("Learn MySQL", "db",NOW()); INSERT INTO tut (title, type, submission_date) VALUES ("Learn Oracle", "db",NOW()); Credit:

Insert rows into another table INSERT INTO types values ("php", "php tutorials",10); INSERT INTO types values ("db", "database tutorials",20);

Query your tables select * from tut ; select * from types; select * from types inner join tut on tut.type = types.type;

Select statement Select – keyword indicating just looking List all columns (* for all; table.column) From – keyword indicating table names follow Table name Join type + next table + on + matching fields Where – keyword indicating row selection Column = something

Switch to another database Show databases Use

MySQL Workbench Mysql IDE Free community version – Install with connector/J so you can connect to java – Your server password is critical Models vs Database vs Server Instance – Model forward engineer to database – Forward engineer script can be run on panther

Java and Sql Need a connection driver – Mysql : connecter /j -> jdbc – Java: – Add mysql connector/j jar file to your IDE – Your code: Import java.sql.* Load the jdbc driver inside your code – Class.forName("com.mysql.jdbc.Driver").newInstance(); Create a connection object – Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306"," root","root");

Java and SQL cont Make an sql statement object – Statement st = conn.createStatement(); Build a statement – String aSQLst = "create database warehouse" Execute the statement – st.execute(aSQLst);

Java and SQL get results Select statement will return a result as a result set object Create the result set object – ResultSet rs = null Execute your select – rs = st.execute("select * from mytable"); Loop through results: while (rs.next()){ int num = rs.getInt("numColumn"); String word = rs.getString("name"); }

Summary What is SQL How to open a database How to create tables How to query tables – very, very basic How to switch database context Using SQL with Java