* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Week 5 (10/02/12): Lecture Notes
Serializability wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Relational model wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Database model wikipedia , lookup
Concurrency control wikipedia , lookup
Clusterpoint wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Fall 2012 ITEC 450 MODULE 2 DATABASE INSTALLATION AND CONFIGURATION 1 Section 5 Database Connectivity MULTI-TIER CLIENT/SERVER ARCHITECTURE Fall 2012 ITEC 450 Thinnest clients Business rules on separate server DBMS only on DB server 2 FUNCTIONS OF TIERS Fall 2012 ITEC 450 3 DATABASE CONNECTIVITY API Fall 2012 The database connectivity application programming interface (API) performs three functions: Establish a connection with a database or access any tabular data source  Send SQL statements  Process the results ITEC 450  There are many standards of API’s. For DBMSindependent usage, the most common ones are ODBC and JDBC. ODBC goal is to make it possible to access any data (relational or non-relational) from any application, regardless of which DBMS is handling the data.  JDBC is for between the Java programming language and a wide range of database.  4 OPEN DATABASE CONNECTIVITY (ODBC ) ARCHITECTURE Fall 2012 Client does not need to know anything about the DBMS ITEC 450 Application Program Interface (API) provides common interface to all DBMSs 5 Each DBMS has its own ODBC-compliant driver ODBC ROLE Fall 2012 ITEC 450 6 JAVA DATABASE CONNECTIVITY (JDBC) ARCHITECTURE Fall 2012 JDBC API contains two major sets of interfaces  First, the JDBC API for application writes ITEC 450  Second, the lower-level JDBC driver API for driver writers JDBC technology drivers fit into one of four categories 1. JDBC-ODBC bridge plus ODBC drivers 2. A native API partly Java technology-enabled driver: converts JDBC into DBMSspecific client API 7 JAVA DATABASE CONNECTIVITY (JDBC) ARCHITECTURE (CONTINUE) Fall 2012 Four categories (continue) 4. Direct-to-Database pure Java Driver: converts JDBC into DBMS-specific network protocol, allowing a direct call from the client machine to the DBMS server Pure Java Driver for Database Middleware: translates JDBC into a DBMS protocol by a middleware server, which is then translated to a DBMS protocol by a middleware server. The middleware provides connectivity to many different databases. ITEC 450 3. 8 Fall 2012 ITEC 450 MODULE 2 DATABASE INSTALLATION AND CONFIGURATION 9 Section 6 Oracle 11g Connectivity and Network ORACLE NET SERVICES 2. 3. 4. 5. ITEC 450 1. Fall 2012 Oracle Net Service is a suite of networking components that provide enterprise-wide connectivity solutions in distributed, heterogeneous computing environments. Oracle Net Oracle Net Listener Oracle Connection Manager Networking Tools Oracle Advanced Security 10 C1: ORACLE NET  ITEC 450  Oracle Net enables a network session from a client application to an Oracle database server. Once a network session is established, Oracle Net acts as the data courier for both the client application and the database server. Network protocols: TCP/IP, TCP/IP with SSL, Named Pipes Fall 2012  11 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Start Net Manager in Windows  Expand the Local node  Expand the Service Naming node  Highlight Service Naming, and click the big green plus sign  ITEC 450 Steps: Fall 2012  12 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 13 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 14 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 15 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Steps (continued): ITEC 450 For the connection, select TCP/IP (Internet Protocol) as the protocol  Type the computer name on which the database resides in the Host Name box  Accept the default selection of Oracle8i or later  Fall 2012  16 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 17 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 18 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 19 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Steps (continued):      ITEC 450  Click Test Click Close to close the test window Click Finish to complete the definition Save the configuration Fall 2012  By selecting File/Save Network Configuration from the menu Close Net Manager 20 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 21 STEP-BY-STEP CONFIGURATION OF ORACLE NET SERVICES USING NET MANAGER Fall 2012 ITEC 450 22 C2: ORACLE NET LISTENER  It is the operation unique to the Oracle database server. Once a connection is established, the client and Oracle database server communicate directly with one another. ITEC 450  Oracle Net listener, commonly known as the listener, brokers a client request, handing off the request to the server. Fall 2012  23 TNS CONFIGURATION FILES The listener.ora file  ITEC 450 Stored on the database server  Provides configuration for how the listener process listens over the network, for connection requests  Stored in $ORACLE_HOME/network/admin  Fall 2012  The tnsnames.ora file Placed onto the client machine  Allows communication between client machine and listener on the database sever  24 WORKING WITH THE LISTENER ITEC 450  Fall 2012 Listener listens for requests made by user connections  Process then allocates a server process  Start or stop the listener  Windows Go to the Services window  Use the listener control utility (lsnrctl)   Listener features include: Change queue size  Set listener logging and tracing  25 C2: LISTENER CONFIGURATION Fall 2012 ITEC 450 The default listener configuration file is called “listener.ora”, and it is located in the $ORACLE_HOME/network/admin directory.  The file contains a protocol address that identifies the database.  Example file of “listener.ora” LISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=salesserver)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=plsextproc) (ORACLE_HOME=/oracle10g) (PROGRAM=extproc))) 26 C2: LISTENER MANAGEMENT  Stop the listener   ITEC 450 C:> lsnrctl status  Current status, availability, alias, version, Oracle home, Net address, configuration file location, start time, host  Fall 2012 Oracle Enterprise Manager Database Control or Command Line (lsnrctl)  View information  C:> lsnrctl stop Start the listener C:> lsnrctl start  It is set to start automatically whenever your server computer is restarted  27 C2: CONNECT DESCRIPTOR ITEC 450 Connect Descriptor  Protocol  Database service name Naming Methods to a Connect Descriptor  “tnsnames.ora”  LDAP  External Fall 2012 Connection Requests  User name  Password  Connect identifier Database Service  Listener 28 C2: NAMING METHODS Fall 2012 ITEC 450 A naming method is a resolution method used by a client application to resolve a connect identifier to a connect descriptor when attempting to connect to a database service.  Oracle Net provides support for following naming methods:  Local naming – local file “tnsnames.ora”  Directory naming – LDAP-compliant directory server  Easy connect naming – TCP/IP connect string  External naming – third-party naming service such as Network Information Service (NIS)  29 C2: LOCAL NAMING Fall 2012 ITEC 450 Local Naming is most appropriate for simple distributed networks with a small number of services that change infrequently. It resolves a “net service name” stored in a “tnsnames.ora” file.  The default “tnsnames.ora” file is located in the $ORACLE_HOME/network/admin directory.  When you create a database using DBCA, local naming is configured automatically.  30 C3: ORACLE CONNECTION MANAGER ITEC 450  Oracle connection manager is a router through which a client connection request may be sent either to its next hop or directly to the database server. It is a software component that resides on its own computer, separate from a client or an Oracle database server. Fall 2012  31 C4: NETWORKING TOOLS ITEC 450 Configures listeners and Naming Methods  To start Oracle Net Configuration Assistant:  Fall 2012 Oracle Net Services provides user interface tools to easily configure, manage, and monitor the network.  Oracle Net Configuration Assistant On Windows, choose Start > Programs > Oracle HOME_NAME > Configuration and Migration Tools > Net Configuration Assistant  On UNIX, run netca from $ORACLE_HOME/bin.  Oracle Enterprise Manager  Oracle Net Manager  Enables you to configure Oracle Net Services for an Oracle home on a local client or server host.  Can fine-tune the listener and naming method  32 Fall 2012 ITEC 450 MODULE 2 DATABASE INSTALLATION AND CONFIGURATION 33 Section 6a Oracle Transaction ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 UPDATE table SET user = ‘SHIPERT’ WHERE id = 12345 34 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 35 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 36 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 37 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 38 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 39 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 1 row Updated 40 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 Commit 41 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 Commit Successful 42 ORACLE TRANSACTION EXAMPLE: UPDATE Fall 2012 ITEC 450 43