本Jython安装例子主要是针对Jython需要连接多个数据库(Oracle和TimesTen)来写。
Jython安装前提:
1、本用户下,可以通过sqlplus连接Oracle,也就是Oracle的客户端安装完整,环境变量设置正确。
2、本用户下,可以通过ttisqlcs连接TimesTen数据库,则表示TimesTen的客户端安装完成,环境变量正确。
3、JDK要求版本在1.4以上,最好是1.5版本以上。
Jython安装工作的主要目标:
Jython运行依赖JDK,所以必须要设置JDK的路径。
Jython要连接Oracle,当然必须要告知Jython,Oracle JDBC所在的路径(一般在ORACLE_HOME/jdbc下)。
要连接TimesTen,也必须要告知Jython,TimesTen JDBC所在的路径(一般在TT_HOME/lib下)。
JDBC路径下一般有多个版本的JDBC jar包文件,建议使用和JDK版本一致的,如果相同版本没有,则选择小一号的版本。
详细Jython安装步骤:
第一步:安装指令:java -jar jython_installer-2.2.1.jar --console
- Welcome to Jython !
- You are about to install Jython version 2.2.1
- (at any time, answer c to cancel the installation)
- For the installation process, the following languages are available: English, German
- Please select your language [e/g] >>> e
- Do you want to read the license agreement now ? [y/n] >>> n
- Do you accept the license agreement ? [y/n] >>> y
- The following installation types are available:
- 1. All (everything, including sources)
- 2. Standard (core, library modules, demos and examples, documentation)
- 3. Minimum (core)
- 9. Standalone (a single, executable .jar)
- Please select the installation type [1/2/3/9] >>> 1
- Do you want to exclude parts from the installation ? [y/n] >>> n
- Please enter the target directory >>> /home/lsabm/jy
- Unable to find directory /home/lsabm/jy, create it ? [y/n] >>> y
- Please enter the target java home directory (== for current) >>> /usr/java5_64
- Checking java version ...
- Your java version to start Jython is: IBM Corporation / 1.5.0
- Please press Enter to proceed >>>
- Your operation system version is: AIX / 5.3
- This operating system might not be fully supported.
- Please press Enter to proceed anyway >>>
- Summary:
- - mod: true
- - demo: true
- - doc: true
- - src: true
- - JRE: /usr/java5_64
- Please confirm copying of files to directory /home/lsabm/jy [y/n] >>> y
- 10 %
- 20 %
- 30 %
- 40 %
- 50 %
- 60 %
- 70 %
- 80 %
- 90 %
- 100 %
- Generating start scripts ...
- 100 %
- Do you want to show the contents of README ? [y/n] >>> n
- Congratulations! You successfully installed Jython 2.2.1 to directory /home/lsabm/jy.
第二步:配置java、oracle jdbc和tt jdbc路径。
cd jython安装路径
vi jython (下面是jython文件的内容,加粗部分是需要确认路径是否正确的)
- #!/bin/sh
- # This file was generated by the Jython installer
- # Created on Tue Apr 28 10:35:21 CDT 2009 by lsabm
- CP="$ORACLE_HOME/jdbc/ojdbc4.jar:$TT_HOME/lib/ttjdbc5.jar:/home/lsabm/jython/jython.jar"
- if [ ! -z "$CLASSPATH" ]
- then
- CP=$CP:$CLASSPATH
- fi
- "/usr/java5_64/bin/java" -Dpython.home="/home/lsabm/jython" -classpath "$CP" org.python.util.jython "$@"
【编辑推荐】