📄 makefile
字号:
## Makefile for compiling and executing # demo/samples/generic/*.java## Usage: make <all> | <thin> | <oci> | <ocitns> | <single demo>## Before you run any demo programs, you should:# 1. set up your database and schema. Please refer to Samples-Readme.txt,# section "Setting Up Schemas" for details.# 2. Modify this makefile to use appropriate host/port/service_name# search for MODIFY_HERE ... to process your modification## Features demonstrated:# 1. basic JDBC 1.22 features, such as Select, Insert, Define Column Type,# embeded PL/SQL procedure, Prefetch, Batch execution, and Stream I/O.# 2. JDBC 2.0 features, such as Connection Cache, Statement Cache, DataSource,# JNDI, PooledConnection, ResultSet, RowSet(OracleCachedRowSet), and XA.# 3. JDBC 3.0 features, such as transaction savepoint.# 4. connection wrapping feature.# 5. Oracle 9i features are demonstrated at sub directories -- JavaObject1,# Inheritance, and NestedConnection# 6. This test needs interactive inputs## Notes on Oracle Connection Wrapper:# oracle.jdbc.OracleConnectionWrapper is an implementation of a connection# wrapper originally developed for testing. The compiled code is provided in# the distributed classesNN.zip/jar files and the source is in WrapperSource/.# While some implementations might be able to use the class directly by# extending it for their own use. It is anticipated that many will require an# implementation in a class in their own hierarchy. Given that Java provides# single inheritance of implementation it would be necessary to provide all# the forwarding methods. This source is provided to assist in that effort.# Please be aware that using the source will produce problems when the Oracle# JDBC API is changed in the future whereas extending the Oracle supplied class# should not. This is the JDK1.2 version of this class. See the comment block# which has JDBC 3.0 interfaces for JDK1.4 and up.## For JDK1.1 you must edit the references to java.util.Map to use# java.util.Dictionary# JDBC_URL=jdbc:oracle:oci:@JDBC_URL_2=jdbc:oracle:oci:@# MODIFY_HERE# You could choose an appropriate directory to store file1 and file2# The files and directory should be presented prior to running the demoTMPDIR=${ORACLE_HOME}/tmpdirDEMO_CLASSPATH=.:${ORACLE_HOME}/jlib/jndi.jar:${ORACLE_HOME}/jlib/jta.jarCLASSPATH12=${ORACLE_HOME}/jdbc/lib/classes12.jar:${ORACLE_HOME}/jdbc/lib/ocrs12.zip:${DEMO_CLASSPATH}:${ORACLE_HOME}/jlib/providerutil.jar:${ORACLE_HOME}/jlib/fscontext.jar# classpath for JDK1.4 used by Svpt1.java CLASSPATH14=${ORACLE_HOME}/jdbc/lib/ojdbc14.jar:.# MODIFY_HERE: Please use a correct path on your machine# JDK1.2 install dir used by most of the demosJDK12_HOME=/usr/local/packages/jdk1.2# MODIFY_HERE: Please use a correct path on your machine# JDK1.4 install dir used by Svpt1.javaJDK14_HOME=/usr/local/packages/j2sdk1.4.0# choose JDK1.2 and classes12.jar as the default settings.JAVAC=${JDK12_HOME}/bin/javacJAVA=${JDK12_HOME}/bin/javaall: clobber compile run# MODIFY_HERE: Please use appropriate <host> <port> and <service_name>thin: make all JDBC_URL=jdbc:oracle:thin:@//localhost:1521/orcl.oracle.comoci: make all JDBC_URL=jdbc:oracle:oci:@# MODIFY_HERE: Please use appropriate <host> <port> and <service_name>ocitns: make all JDBC_URL="jdbc:oracle:oci:@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=tcp\)\(HOST=localhost\)\(PORT=1521\)\)\(CONNECT_DATA=\(SERVICE_NAME=orcl.oracle.com\)\)\)"compile: compile_12 compile_14# compile demos that use JDK1.2 and classes12.jarcompile_12: $(JAVAC) -classpath $(CLASSPATH12) -g ArrayExample.java \ CCache1.java CCache2.java CCache3.java \ FixedWaitThread.java CCache4.java CCache5.java \ CCache6.java CCache7.java \ ConnectionWrapperSample.java \ DataSource.java DataSourceJNDI.java \ Employee.java ORADataExample.java \ EmployeeObj.java SQLDataExample.java \ FileExample.java PLSQL_FileExample.java \ InsertExample.java SelectExample.java DefineColumnType.java \ JdbcCheckup.java JdbcMTSample.java \ LobExample.java OpenCloseLob.java \ PLSQL.java PLSQLExample.java PLSQL_LobExample.java \ PersonObject.java PersonRef.java \ PooledConnection1.java PooledConnection2.java \ GenREF.java RefClient.java RefCursorExample.java \ ResultSet1.java ResultSet2.java ResultSet3.java \ ResultSet4.java ResultSet5.java ResultSet6.java \ RowPrefetch_connection.java RowPrefetch_statement.java \ RowSet01.java RowSet02.java RowSet03.java RowSet04.java \ SendBatch.java SetExecuteBatch.java BatchUpdates.java \ StmtCache1.java StmtCache2.java \ StreamExample.java \ TemporaryLob.java TrimLob.java \ XA1.java XA2.java XA3.java XA4.java XA5.java%.class: %.java $(JAVAC) -classpath $(CLASSPATH12) -g $<# compile demos that use JDK1.4 and ${ORACLE_HOME}/jdbc/lib/ojdbc14.jarcompile_14: $(JDK14_HOME)/bin/javac -classpath $(CLASSPATH14) -g Svpt1.javarun: run_12 run_14run_12: SelectExample DefineColumnType InsertExample JdbcCheckup JdbcMTSample \ PLSQL PLSQLExample RefCursorExample RowPrefetch_connection \ RowPrefetch_statement SendBatch SetExecuteBatch StreamExample \ DataSource DataSourceJNDI \ PooledConnection1 PooledConnection2 \ XA1 XA2 XA3 XA4 XA5 \ CCache1 CCache2 CCache3 CCache4 CCache5 CCache6 CCache7 \ StmtCache1 StmtCache2 \ BatchUpdates \ ResultSet1 ResultSet2 ResultSet3 ResultSet4 ResultSet5 ResultSet6 \ RowSet01 RowSet02 RowSet03 RowSet04 \ ArrayExample ORADataExample LobExample \ OpenCloseLob PLSQL_LobExample \ PersonObject PersonRef \ RefClient TemporaryLob TrimLob \ FileExample PLSQL_FileExample \ ConnectionWrapperSamplerun_14: Svpt1SelectExample: SelectExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) SelectExampleDefineColumnType: DefineColumnType.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) DefineColumnTypeInsertExample: InsertExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) InsertExampleJdbcCheckup: JdbcCheckup.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) JdbcCheckupJdbcMTSample: JdbcMTSample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) JdbcMTSamplePLSQL: PLSQL.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PLSQLPLSQLExample: PLSQLExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PLSQLExampleRefCursorExample: RefCursorExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RefCursorExampleRowPrefetch_connection: RowPrefetch_connection.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowPrefetch_connectionRowPrefetch_statement: RowPrefetch_statement.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowPrefetch_statementSendBatch: SendBatch.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) SendBatchSetExecuteBatch: SetExecuteBatch.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) SetExecuteBatchStreamExample: StreamExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) StreamExampleDataSource: DataSource.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) DataSource# MODIFY_HERE# The sub-directories JNDI/ and JNDI/jdbc must be present in this directory,# Or you could replace it with an appropriate pathDataSourceJNDI: DataSourceJNDI.class -rm ./JNDI/jdbc/.bindings $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) \ DataSourceJNDI ./JNDIPooledConnection1: PooledConnection1.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PooledConnection1PooledConnection2: PooledConnection2.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PooledConnection2BatchUpdates: BatchUpdates.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) BatchUpdatesCCache1: CCache1.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache1CCache2: CCache2.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache2CCache3: CCache3.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache3CCache4: CCache4.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache4CCache5: CCache5.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache5CCache6: CCache6.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache6CCache7: CCache7.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) CCache7XA1: XA1.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) XA1XA2: XA2.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) XA2XA3: XA3.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) XA3XA4: XA4.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) \ -DJDBC_URL_2=$(JDBC_URL_2) XA4 localhost 1521 orcl.oracle.comXA5: XA5.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) XA5ResultSet1: ResultSet1.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet1ResultSet2: ResultSet2.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet2ResultSet3: ResultSet3.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet3ResultSet4: ResultSet4.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet4ResultSet5: ResultSet5.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet5ResultSet6: ResultSet6.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ResultSet6StmtCache1: StmtCache1.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) StmtCache1StmtCache2: StmtCache2.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) StmtCache2# RowSet binaries are in $ORACLE_HOME/jdbc/lib/ocrs12.zipRowSet01: RowSet01.class sqlplus hr/hr < rowset.sql $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowSet01RowSet02: RowSet02.class sqlplus hr/hr < rowset.sql $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowSet02RowSet03: RowSet03.class sqlplus hr/hr < rowset.sql $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowSet03RowSet04: RowSet04.class sqlplus hr/hr < rowset.sql $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) RowSet04ArrayExample: ArrayExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ArrayExampleORADataExample: ORADataExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ORADataExample# MODIFY_HERE: The binary files file1 and file2 must be present in $(TMPDIR).# You could choose a different TIMPDIRFileExample: FileExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) FileExample $(TMPDIR)LobExample: LobExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) LobExampleOpenCloseLob: OpenCloseLob.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) OpenCloseLob# MODIFY_HERE: The binary files file1 and file2 must be present in $(TMPDIR)# You could choose a different TIMPDIRPLSQL_FileExample: PLSQL_FileExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PLSQL_FileExample $(TMPDIR)PLSQL_LobExample: PLSQL_LobExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PLSQL_LobExamplePersonObject: PersonObject.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PersonObjectPersonRef: PersonRef.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) PersonRefRefClient: RefClient.class sqlplus hr/hr < RefClient.sql $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) -DJDBC_URL_2=$(JDBC_URL_2) RefClientSQLDataExample: SQLDataExample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) SQLDataExampleTemporaryLob: TemporaryLob.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) TemporaryLobTrimLob: TrimLob.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) TrimLobConnectionWrapperSample: ConnectionWrapperSample.class $(JAVA) -classpath $(CLASSPATH12) -DJDBC_URL=$(JDBC_URL) ConnectionWrapperSampleSvpt1.class: - if [ ! -f "Svpt1.class" ]; then make compile_14; fi # use JDK1.4 and ${ORACLE_HOME}/jdbc/lib/ojdbc14.jarSvpt1: Svpt1.class $(JDK14_HOME)/bin/java -classpath $(CLASSPATH14) -DJDBC_URL=$(JDBC_URL) Svpt1clobber: rm -f *.class rm -f *.out
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -