MC365 JDBC in Servlets. Today We Will Cover: DBVisualizer Using JDBC in servlets Using properties files.

Slides:



Advertisements
Similar presentations
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
Advertisements

Tux2 Database The Architecture of Our System © Juhani Välimäki 2005.
MC365 JDBC and Server-Side Programming: Updating a database via JDBC & Connection Pooling.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
ORACLE Lecture 1: Oracle 11g Introduction & Installation.
MC365 Ant. Today We Will Cover: Overview of Ant Installing Ant Using the Ant command line tool Various Ant commands available Using Ant in Eclipse.
Distributed Application Development B. Ramamurthy.
Installing JDK and Tomcat Vijayan Sugumaran Department of DIS Oakland University.
System Administration Accounts privileges, users and roles
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
P2-S1 MySQL 2003 SJSU -- CmpE-- M.E. Fayad Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
Compe 341 Oracle Installation Procedure. Oracle From Click.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
TUTORIAL (1) Software installation Written by: Eng. Ahmed Mohamed Abdel Ghafar, Edited by Eng. Muhammed Hammad, Eng. Hamdy Soltan & Eng. Osama Talaat.
DB Audit Expert v1.1 for Oracle Copyright © SoftTree Technologies, Inc. This presentation is for DB Audit Expert for Oracle version 1.1 which.
Tutorial SQL Server and Matlab CIS 526. Build a New Database in SQL server.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Getting Started with Oracle11g Abeer bin humaid. Create database user You should create at least one database user that you will use to create database.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Installing DSpace on Window Bharat M. Chaudhari School of Petroleum Management, PANDIT DEENDAYAL PETROLEUM UNIVERSIRY, GANDHINAGAR
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
CSCI 6962: Server-side Design and Programming
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Multiple Cases Access Utilities1 Access & ODBC Managing and Using ODBC Connections P.O. Box 6142 Laguna Niguel, CA
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Installing the SAFARIODBC.EXE For use with Excel May 3, 2002.
SqlReports Dean Dahlvang PSUG-MO March About Dean Dean Dahlvang Director of Administrative Technology for the Proctor.
CSE 305 Theory of Database Tutorial on Connecting with Sybase from Java program and Developing GUI Jalal Mahmud, TA, CSE 305.
M1G Introduction to Database Development 6. Building Applications.
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,
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Installation and Testing.
Servlets Database Access. Agenda:  Setup Java Environment  Install Database  Install Database Drivers  Create Table and add records  Accessing a.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
Most information comes from Chapter 3, MySQL Tutorial: 1 MySQL: Part.
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
IBM Office Connect 3.0 James Edmiston Consultant Quest Information Systems, Inc Mike Terrell IT Specialist IBM Data.
1 Introduction to Web Applications & APIs. 2 Agenda  Architecture of Web Applications Three layer architecture  Web Server (Tomcat) Installation Data.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
RAD to Database Connection Glenn Campbell
{ SUSTAIN Technologies Inc. eCourt: Intro to Crystal Reports SUSTAIN Technologies Inc.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
JSP Server Integrated with Oracle8i Project2, CMSC691X Summer02 Ching-li Peng Ying Zhang.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
JDBC Java and Databases. SWC – JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
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.
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.
Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio.
Settings MySQL Database and JDBC configuration Instructor: Sergey Goldman.
E Copyright © 2006, Oracle. All rights reserved. Using SQL Developer.
16 Copyright © 2004, Oracle. All rights reserved. Testing the Migrated Oracle Database.
9 Copyright © 2004, Oracle. All rights reserved. Getting Started with Oracle Migration Workbench.
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
2 Copyright © 2008, Oracle. All rights reserved. Building the Physical Layer of a Repository.
Data Virtualization Demoette… ODBC Clients
Working in the Forms Developer Environment
W04 Connecting 3rd Party Application to ODBC
JDBC Database Management Database connectivity
Data Virtualization Demoette… JDBC Clients
Introduction to Web programming
Author – Akash Pramanik
Developing a Model-View-Controller Component for Joomla Part 3
Presentation transcript:

MC365 JDBC in Servlets

Today We Will Cover: DBVisualizer Using JDBC in servlets Using properties files

DBVisualizer DBVisualizer is a tool used to manipulate a database. –Other similar tools are SQL Plus, PL/SQL, Toad –DBA’s use these tools to perform database functions like setting up table spaces, tables, user access, triggers and stored procedures. –The focus of this class is not database administration (this is usually the job of the DBA), but it is important for software engineers to be familiar with some DBA functions. Especially in a 3-tier architecture

DBVisualizer For this class, a DBA has already set up an Oracle instance for us to use. –The table spaces and user access have already been set up for us. –In most organizations a DBA will be responsible for these functions. As software engineers, we are going to use DBVisualizer to: –Create and alter tables –Populate our tables –Test SQL statements –Write stored procedures (later) It is important for a software engineer to be comfortable with database functions and tools, even though the DBA will most likely be responsible for them.

Installing DBVisualizer Why use DBVisualizer? –SQL Plus is command line. –DBVisualizer, PL/SQL and Toad are more GUI- oriented making them easier to use. –It’s Java-based and uses JDBC itself – perfect for testing in applications. If it works here, it will work in your servlet. –It supports a variety of databases. –It is free. You can download DBVisualizer from here:

Connecting to Our DB Using DBVisualizer Once you have installed DBVisualizer, you can connect to the Oracle instance set up for this class: –Go to File – JDBC Driver Manager Point to the classes12.zip file –Go to Database – Add Database Connection –Enter info: Database alias:goanna JDBC driver:oracle.jdbc.driver.OracleDriver Userid:your username Password:your password –Try connecting using this password and make sure it works. –If you have problems or want me to change the password, let me know.

SQL in DBVisualizer Once you are connected, you can navigate to your tablespace by clicking on the Database Objects tab. You can also create and execute SQL statements in your tablespace by clicking on the SQL Commander tab. Here are some example SQL statements you can use as models for creating, altering, updating and querying your tables. Notes/SQLExamples.doc Notes/SQLExamples.doc

Using JDBC in Servlets To see an example of a simple Java application connecting to an Oracle instance via JDBC go to: Notes/JDBCTest.java Notes/JDBCTest.java Note: Do not put a semicolon at the end of SQL statements in Java. To see an example of a servlet connecting to an Oracle instance via JDBC go to: Notes/JDBCServlet.java Note: To use the Oracle driver (instead of the ODBC driver) to connect to an Oracle instance, you need to put the appropriate class files into the application server. These class files are in a zip file called Classes12.zip. You need to unzip the class files in this zip file into the following directory: c:\Program Files\Apache Group\Tomcat 4.1\common\classes. Classes12.zip can be downloaded from Oracle’s site or here. Notes/JDBCServlet.javahere

Properties Files What is a properties file? –A properties file is a simple text file. You can create and maintain a properties file with just about any text editor. You should always create a default properties file. The name of this file begins with the base name of your ResourceBundle and ends with the.properties suffix. Why use a properties file? –Properties files allow you to keep hard-coded values that might change in a text file. Text files are much easier to modify than java source code. –Note: Any time you make a change to a properties file, you need to restart the Tomcat for the changes to take effect. How do you reference a properties file in Java? –Use the ResourceBundle object. See the JDBCServlet.java code for an example of how to use a properties file –Click on this link to see an example of a properties file: Notes/db.properties. Notes/db.properties –You can put the properties file used by the servlet in the same folder that the class file is in under Tomcat (e.g. WEB-INF/classes)