How to set the page number of a paper
1. Select Insert in the menu bar, enter the footer option, and click Edit Footer in the pop-up window.
Second, design options will appear in the menu bar. Click the page number and select the bottom of the page in the pop-up window. At this time, various styles will appear at the bottom. Generally choose the middle page number, that is, choose the ordinary number 2.
Third, click the common number 2 option.
4. Graduation thesis sometimes needs to use other page numbers instead of ordinary Arabic numerals. At this time, we need to click the format page number option in the page number option.
5. In the Page Number Format window, select the page number format, start the page number, and then click OK.
6. Finally, the numbers appear in the footer.
A model essay on java
Development of Java-based stored procedures in Oracle
Abstract: A stored procedure is a database object. The execution plan is stored in the server of the database, and its execution speed is faster than that of the same program independently. Any well-designed database application should use stored procedures. Stored procedures can make it easier to manage databases and display information about databases and their users. The development steps of Java stored procedures are analyzed in detail.
Keywords: Java stored procedure, Oracle9i database, Java function
I. introduction of stored procedures
The concept of 1. stored procedure
Stored procedure is a kind of database object, which stores the execution plan in the server of the database, and its execution speed is faster than executing the same program independently. Stored procedures can make it easier to manage databases and display information about databases and their users. Stored procedures can contain data streams, logic, and queries to the database. In Oracle9i, application developers can not only use PL/SQL, but also use Java to develop their business logic, and deploy these business logic as stored procedures, functions and triggers in the database.
When calling the Java stored procedure, the database will run the stored procedure directly without compiling. Compared with SQL statements or PL/SQL blocks, its execution speed is faster.
2. Guidelines for designing stored procedures
(1) When defining a stored procedure, it should be used to complete a single, relatively centralized task.
(2) When defining a stored procedure, don't use functions provided by other features to define the procedure. For example, do not define a process to enforce data integrity (using integrity constraints).
3. Types of stored procedures
Oracle9i supports four different types of stored procedures, all of which can be implemented in PL/SQL or Java. These four types of stored procedures are stored procedures, stored functions, database triggers and object type methods.
4. Call of stored procedure
In Oracle9i, each of these four types of stored programs can be called from different calling environments, namely, SQL statement or DML statement, top-level calling syntax, PL/SQL block, subroutine (package) and implicit calling of trigger.
Secondly, the development and design of Java stored procedures in the teacher information management system.
General steps for creating Java stored procedures
(1) Development steps of Java stored procedures: Write Java source code, load Java codes and classes into Oracle9i database, generate calling instructions, and call JSP.
There are several steps to convert java methods into Java stored procedures, including: loading Java classes into the database with loadjava utility, publishing Java methods with calling specifications, and mapping Java methods, parameter types and return types to their SQL counterparts.
(2) Writing Java source code
When developing Java stored procedures, you must first write Java source code.
Import? ; //Import Java classes
Public class p 1// Create a public class.
{
?
Public static viod method a() // method 1
{
?
}
}
(3) Load Java codes and classes into Oracle9i database.
After writing Java source code, Java code and corresponding Java classes should be loaded into Oracle9i database. As shown in figure 1:
Java classes in figure 1 Oracle 9i
There are two ways to load Java code and classes into RDBMS:
? Using the loadjava tool, you can quickly load java source code (. Java), Java binary code (. Class) and Java package files (. Jar).
? Load Java code using CREATE Java and ALTER Java.
(4) generating a call description
After loading Java classes, the computer paper should generate the call description of public static methods, and finally complete the development of Java stored procedures.
After completing the above steps, the development of Java stored procedures is completed, and then you can call and execute Java stored procedures.
2. Using Java development process
Procedures are used to perform operations. It should be noted that the return value of the Java method corresponding to the procedure must be void. This section takes creating JSP for inserting, modifying and deleting diagrams as an example to illustrate the method of using Java development process. As shown in Figure 2:
Figure 2 An example of the development process using Java
Here are the methods and processes to accomplish the above tasks:
(1) Writing Java source code
The list of programs is as follows (manipulate_teachers.java):
Import java.sql. *;
Import java.io. *;
Import Oracle.jdbc.driver. *;
Public Class Manipulation _ Teachers {
Public Static Null Insert _ Teacher
(String code, string name, integer gender, string birth date, string input date and time)
Raise SQLException {
/* Establish a default connection to the database */
Connect conn = newOracleDriver (). default connection();
/* Construct dynamic SQL statements */
The string sql = "is inserted into the teacher.
(Teacher code, name, gender, date of birth, input date and time) "+
"Values (? ,? ,? ,? ,? )";
/* Use the try...catch statement to get and throw an exception */
Try {
/* Prepare dynamic SQL statements */
prepared statement pstmt = conn . prepare statement(SQL);
/* Set dynamic SQL parameter values */
Pstmt.setString( 1, code);
pstmt.setString(2,name);
Pstmt.setInt(3, sex);
Pstmt.setString(4, birthday);
pstmt.setString(5,entry _ date _ time);
/* Execute dynamic SQL statements */
PS TMT . execute update();
/* Close the dynamic SQL statement */
pstmt . close();
} catch (SQLException e) {}
}
Public static void delete _ teachers (string code)
Raise SQLException {
Connect conn = newOracleDriver (). default connection();
string SQL = " delete from teachers WHERE teachers _ code =?" ;
Try {
prepared statement pstmt = conn . prepare statement(SQL);
Pstmt.setString( 1, code);
PS TMT . execute update();
pstmt . close();
} catch (SQLException e) {}
}
Public static void modify_salary (string code, floating salary)
Raise SQLException {
Connect conn = newOracleDriver (). default connection();
string SQL = " update teachers SET salary =? Where the teacher code =? ”;
Try {
prepared statement pstmt = conn . prepare statement(SQL);
Pstmt.setFloat( 1, salary);
Pstmt.setString(2, code);
PS TMT . execute update();
pstmt . close();
} catch (SQLException e) {}
}
}
(2) Load Java codes and classes into Oracle9i database.
After writing Java source code, you can load Java objects into Oracle9i database. Here are ways to accomplish this task:
//Set the environment variable classpath
set class path = c:\ Oracle \ ora9l \ JDBC \ classes ll . zip;
c:\ Oracle \ ora9l \ sqlj \ runtime . zip;
c:\ Oracle \ ora9l \ sqlj \ translator . zip;
load Java-user ACA/xtg toup @ xtdh-o-y-f-rd:\ JSP \ manipulate teachers . Java
(3) Publish Java and generate calling instructions.
After loading a Java class, you can publish the Java class and generate a procedure description that calls its methods. Here are ways to accomplish this task:
①//Log in to the database
Sqlplus aca/xtgroup@xtbdh
(2) create or replace process insert _ teacher
(code var char 2, name varchar2, sex number;
Birthday varchar2, entry date time varchar2
) as that java name of the language.
? mainpulate _ auths . insert _ teachers(Java . lang . string,
Java . lang . string . int . Java . lang . string . Java . lang . string)? ;
③ Create or replace the process delete_teachers(codevarchar2).
Java name as a language
? manipulate _ teachers . delete _ teachers(Java . lang . string)? ;
④ Create or replace the process modify_salary.
(code varchars2, salary number) aslanguage java name
? manipulate _ auths . midify _ salary(Java . lang . string,float)? ;
(4) Call JSP
After generating the process description of calling Java methods, we can call JSP. For example:
//Insert record
Call Insert _ Teacher (? A000 12? ,? Zhang Yun? , 1,? 16-JUN- 1968? ,? 65438+June 6, 2006? );
//Modify teachers' salaries
Call modify_salary (? A000 12? ,2000);
//Delete teacher records
Call delete _ teacher (? A000 12? );
(5) Analysis
We use Java stored procedures here. Compared with PL/SQL, the stored procedures developed by Java language are only sent to the database once, and the network traffic is less than that of SQL statements or PL/SQL blocks. Moreover, when calling the Java stored procedure, the database will run the stored procedure directly without compiling. Compared with SQL statements or PL/SQL blocks, it saves compilation time, so its execution speed is faster.
3. Develop functions with Java
The function returns specific data. The method of using Java development function can be illustrated by creating a title and number of courses returned to the teacher.
Fig. 3 is an example of developing functions using Java.
Three. Concluding remarks
Any well-designed database application should use stored procedures. Stored procedures can make it easier to manage databases and display information about databases and their users. Stored procedures can help you separate logic from code. The integration of Oracle database and Java VM can create portable, powerful and database-independent data logic and persistent logic. Java language has more powerful computing power and provides more computing methods, which can be applied to more database systems (such as Sybase, DB2, Informix, etc. ). Java stored procedures can solve the problem that different database vendors use various proprietary and database-dependent implementation languages. Use Java stored procedures to communicate with SQL, XML, Java, J2EE and Web services.
References:
1. Kevin Ronnie, Marlene Siriott, etc. , translated by Jiang Rui and Wang Leyan. Oracle 9i Database Administrator Manual [M]. Beijing: Machinery Industry Press, 2005.
2. Ding and Peng Dunlu. Java programming [M]. Beijing: Higher Education Press, 2005.
3. John Canel waits, translated by Compaq. Oracle 9i Java programming? Solutions using PL/SQL and Java [M]. Beijing: Tsinghua University Publishing House, 2002.
4. Zhou Yuezhi. OracleJ2EE application development [M]. Beijing: Tsinghua University Publishing House, 2005.
5. wang hong, Julie. Design and Application of Database Stored Procedure [M]. Electronic Information Countermeasure Technology, No.2, 2009-
Did you get a look at him? How to set the page number in the paper? People still see:
1. How to set the paper page number?
2. How to set the page number of the paper?
3. How to set the page number of graduation thesis?
4. How to set the page number of the paper?
5. How to set the page number of graduation thesis?