在WebLogic中配置TimesTen数据源

安装WebLogic

WebLogic软件可以从OTN上下载,我们使用的是Quick Installer for Mac OSX, Windows and Linux,大约209MB。安装过程完全参照附带的readme文件。

首先创建用户weblogic,此用户会用于后续安装WebLogic:

# useradd weblogic
# passwd weblogic
# su - weblogic
$ java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
# 设置JAVA_HOME
$ export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
$ echo $JAVA_HOME
/usr/java/jdk1.8.0_172-amd64
# 然后将JAVA_HOME设置到.bash_profile中
$ echo 'export JAVA_HOME=/usr/java/jdk1.8.0_172-amd64' >> ~/.bash_profile


然后解压开始安装,安装花了6分多钟:

# 解压安装包
$ unzip fmw_12.2.1.2.0_wls_quick_Disk1_1of1.zip 
Archive:  fmw_12.2.1.2.0_wls_quick_Disk1_1of1.zip
  inflating: fmw_12.2.1.2.0_wls_quick.jar  
  inflating: README.txt              
  inflating: fmw_12212_readme.htm 
$ mkdir ~/oracle
$ time java -jar ./fmw_12.2.1.2.0_wls_quick.jar ORACLE_HOME=~/oracle
Launcher log file is /tmp/OraInstall2018-07-27_03-12-33PM/launcher2018-07-27_03-12-33PM.log.
Extracting the installer . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2733.984 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 2047 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 5996 MB    Passed


Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2018-07-27_03-12-33PM
Log: /tmp/OraInstall2018-07-27_03-12-33PM/install2018-07-27_03-12-33PM.log
Setting ORACLE_HOME to /home/weblogic/oracle

*****************************************************


Distribution Name : Oracle Fusion Middleware 12c WebLogic and Coherence Developer
Distribution Version : 12.2.1.2.0

Oracle Inventory : /home/weblogic/oraInventory

Oracle Home : /home/weblogic/oracle
Java Home : /usr/java/jdk1.8.0_172-amd64

*****************************************************

Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
Skipping Software Updates
Starting check : CertifiedVersions
Expected result: One of oracle-6,oracle-7,redhat-7,redhat-6,SuSE-11,SuSE-12
Actual Result: oracle-7.4
Check complete. The overall result of this check is: Passed
CertifiedVersions Check: Success.


Starting check : CheckJDKVersion
Expected result: 1.8.0_101
Actual Result: 1.8.0_172
Check complete. The overall result of this check is: Passed
CheckJDKVersion Check: Success.


Validations are enabled for this session.
Verifying data
Copying Files
Percent Complete : 10
Percent Complete : 20
Percent Complete : 30
Percent Complete : 40
Percent Complete : 50
Percent Complete : 60
Percent Complete : 70
Percent Complete : 80
Percent Complete : 90
Percent Complete : 100

The installation of Oracle Fusion Middleware 12c WebLogic and Coherence Developer 12.2.1.2.0 completed successfully.
Logs successfully copied to /home/weblogic/oracle/cfgtoollogs/oui.

real    6m41.259s
user    3m12.765s
sys 0m25.224s

将ORACLE_HOME环境变量设置到启动文件中:

$ echo 'export ORACLE_HOME=/home/weblogic/tmp/wls12212' >> ~/.bash_profile
$ tail -2 ~/.bash_profile
export JAVA_HOME=/usr/java/jdk1.8.0_172-amd64
export ORACLE_HOME=/home/weblogic/oracle/wls12212
$ su - weblogic
$ echo $ORACLE_HOME
/home/weblogic/tmp/wls12212

使用命令行创建一个Domain:

$ . $ORACLE_HOME/wlserver/server/bin/setWLSEnv.sh
CLASSPATH=/usr/java/jdk1.8.0_172-amd64/lib/tools.jar:/home/weblogic/oracle/wlserver/modules/features/wlst.wls.classpath.jar:

PATH=/home/weblogic/oracle/wlserver/server/bin:/home/weblogic/oracle/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/usr/java/jdk1.8.0_172-amd64/jre/bin:/usr/java/jdk1.8.0_172-amd64/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/weblogic/.local/bin:/home/weblogic/bin:/home/weblogic/oracle/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin

Your environment has been set.

$ mkdir ~/domain
$ cd ~/domain
$ java weblogic.Server
<Jul 27, 2018 3:29:27 PM CST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
<Jul 27, 2018 3:29:28 PM CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 
<Jul 27, 2018 3:29:29 PM CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.172-b11 from Oracle Corporation.> 

/home/weblogic/domain/config not found

No config.xml was found.
Would you like the server to create a default configuration and boot? (y/n): y
<Jul 27, 2018 3:29:36 PM CST> <Info> <Management> <BEA-140013> </home/weblogic/domain/config not found> 
<Jul 27, 2018 3:29:36 PM CST> <Info> <Security> <BEA-090065> <Getting boot identity from user.> 
Enter username to boot WebLogic server:weblogic
Enter password to boot WebLogic server:
For confirmation, please re-enter password required to boot WebLogic server:
<Jul 27, 2018 3:29:56 PM CST> <Info> <Management> <BEA-141254> <Generating new domain directory in /home/weblogic/domain.> 
<Jul 27, 2018 3:30:12 PM CST> <Info> <Management> <BEA-141255> <Domain generation completed in 16,344 milliseconds.> 
<Jul 27, 2018 3:30:12 PM CST> <Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.> 
<Jul 27, 2018 3:30:12 PM CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.2.1.2.0 Mon Oct  3 04:35:36 PDT 2016 1827450> 
<Jul 27, 2018 3:30:16 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
<Jul 27, 2018 3:30:16 PM CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.> 
<Jul 27, 2018 3:30:16 PM CST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.> 
<Jul 27, 2018, 3:30:18,499 PM CST> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=1218666382
Current log file=/home/weblogic/domain/servers/myserver/logs/myserver.log
Rotation dir=/home/weblogic/domain/servers/myserver/logs
 is opened. All server side log events will be written to this file.> 
<Jul 27, 2018, 3:30:18,655 PM CST> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm> 
<Jul 27, 2018, 3:30:21,600 PM CST> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm> 
<Jul 27, 2018, 3:30:24,233 PM CST> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm> 
<Jul 27, 2018, 3:30:25,333 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.edit.> 
<Jul 27, 2018, 3:30:25,338 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.domainruntime.> 
<Jul 27, 2018, 3:30:25,349 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.runtime.> 
<Jul 27, 2018, 3:30:29,931 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.> 
<Jul 27, 2018, 3:30:29,932 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
<Jul 27, 2018, 3:30:30,118 PM CST> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.> 
<Jul 27, 2018, 3:30:31,548 PM CST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> 
<Jul 27, 2018, 3:30:31,976 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
<Jul 27, 2018, 3:30:32,264 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> 
<Jul 27, 2018, 3:30:32,464 PM CST> <Warning> <Server> <BEA-002611> <The hostname "localhost", maps to multiple IP addresses: 127.0.0.1, 0:0:0:0:0:0:0:1.> 
<Jul 27, 2018, 3:30:32,520 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,543 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 10.0.2.15:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,543 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,620 PM CST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.> 
<Jul 27, 2018, 3:30:32,622 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 192.168.122.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,623 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,623 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 10.0.2.15:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,623 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,623 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 192.168.122.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:30:32,630 PM CST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> 
<Jul 27, 2018, 3:30:32,680 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> 

# 按Ctrl+C 停止WebLogic
^C<Jul 27, 2018, 3:34:36,891 PM CST> <Notice> <WebLogicServer> <BEA-000388> <JVM called the WebLogic Server shutdown hook. The server will force shutdown now.> 
<Jul 27, 2018, 3:34:36,891 PM CST> <Notice> <WebLogicServer> <BEA-000396> <Server shutdown has been requested by <WLS Kernel>.> 
<Jul 27, 2018, 3:34:36,915 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SUSPENDING.> 
<Jul 27, 2018, 3:34:36,972 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
<Jul 27, 2018, 3:34:36,973 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN.> 
<Jul 27, 2018, 3:34:36,999 PM CST> <Notice> <Log Management> <BEA-170037> <The log monitoring service timer has been stopped.> 
<Jul 27, 2018, 3:34:37,363 PM CST> <Warning> <JMX> <BEA-149513> <JMX Connector Server stopped at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.runtime.> 
<Jul 27, 2018, 3:34:37,364 PM CST> <Warning> <JMX> <BEA-149513> <JMX Connector Server stopped at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.domainruntime.> 
<Jul 27, 2018, 3:34:37,364 PM CST> <Warning> <JMX> <BEA-149513> <JMX Connector Server stopped at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.edit.>

# 进入新建的Domain,可以再次启动WebLogic
$ cd ~/domain/
$ ls start*
startWebLogic.sh
$ ./startWebLogic.sh
.
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000
.
CLASSPATH=/usr/java/jdk1.8.0_172-amd64/lib/tools.jar:/home/weblogic/oracle/wlserver/server/lib/weblogic.jar:/home/weblogic/oracle/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b3/lib/ant-contrib.jar:/home/weblogic/oracle/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/home/weblogic/oracle/wlserver/common/derby/lib/derbynet.jar:/home/weblogic/oracle/wlserver/common/derby/lib/derbyclient.jar:/home/weblogic/oracle/wlserver/common/derby/lib/derby.jar:/usr/java/jdk1.8.0_172-amd64/lib/tools.jar:/home/weblogic/oracle/wlserver/modules/features/wlst.wls.classpath.jar:
.
PATH=/home/weblogic/domain/bin:/home/weblogic/oracle/wlserver/server/bin:/home/weblogic/oracle/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/usr/java/jdk1.8.0_172-amd64/jre/bin:/usr/java/jdk1.8.0_172-amd64/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/weblogic/.local/bin:/home/weblogic/bin:/home/weblogic/oracle/wlserver/../oracle_common/modules/org.apache.maven_3.2.5/bin
.
***************************************************
*  To start WebLogic Server, use a username and   *
*  password assigned to an admin-level user.  For *
*  server administration, use the WebLogic Server *
*  console at http://hostname:port/console        *
***************************************************
Starting WLS with line:
/usr/java/jdk1.8.0_172-amd64/bin/java -server   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -Dweblogic.Name=myserver -Djava.security.policy=/home/weblogic/oracle/wlserver/server/lib/weblogic.policy  -Xverify:none -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader  -javaagent:/home/weblogic/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/home/weblogic/oracle/wlserver/server -Dweblogic.home=/home/weblogic/oracle/wlserver/server      weblogic.Server
<Jul 27, 2018 3:35:48 PM CST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
<Jul 27, 2018 3:35:49 PM CST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 
<Jul 27, 2018 3:35:50 PM CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 25.172-b11 from Oracle Corporation.> 
<Jul 27, 2018 3:35:50 PM CST> <Info> <RCM> <BEA-2165021> <"ResourceManagement" is not enabled in this JVM. Enable "ResourceManagement" to use the WebLogic Server "Resource Consumption Management" feature. To enable "ResourceManagement", you must specify the following JVM options in the WebLogic Server instance in which the JVM runs: -XX:+UnlockCommercialFeatures -XX:+ResourceManagement.> 
<Jul 27, 2018 3:35:52 PM CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.2.1.2.0 Mon Oct  3 04:35:36 PDT 2016 1827450> 
<Jul 27, 2018 3:35:54 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
<Jul 27, 2018 3:35:54 PM CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.> 
<Jul 27, 2018 3:35:55 PM CST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.> 
<Jul 27, 2018, 3:35:56,559 PM CST> <Notice> <Log Management> <BEA-170019> <The server log file weblogic.logging.FileStreamHandler instance=1416587530
Current log file=/home/weblogic/domain/servers/myserver/logs/myserver.log
Rotation dir=/home/weblogic/domain/servers/myserver/logs
 is opened. All server side log events will be written to this file.> 
<Jul 27, 2018, 3:35:57,272 PM CST> <Notice> <Security> <BEA-090946> <Security pre-initializing using security realm: myrealm> 
<Jul 27, 2018, 3:35:58,101 PM CST> <Notice> <Security> <BEA-090947> <Security post-initializing using security realm: myrealm> 
<Jul 27, 2018, 3:35:59,585 PM CST> <Notice> <Security> <BEA-090082> <Security initialized using administrative security realm: myrealm> 
<Jul 27, 2018, 3:36:00,752 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.runtime.> 
<Jul 27, 2018, 3:36:00,844 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.domainruntime.> 
<Jul 27, 2018, 3:36:00,862 PM CST> <Warning> <JMX> <BEA-149512> <JMX Connector Server started at service:jmx:iiop://127.0.0.1:7001/jndi/weblogic.management.mbeanservers.edit.> 
<Jul 27, 2018, 3:36:02,919 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.> 
<Jul 27, 2018, 3:36:02,919 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
<Jul 27, 2018, 3:36:03,52 PM CST> <Notice> <Log Management> <BEA-170036> <The Logging monitoring service timer has started to check for logged message counts every 30 seconds.> 
<Jul 27, 2018, 3:36:03,890 PM CST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> 
<Jul 27, 2018, 3:36:04,68 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
<Jul 27, 2018, 3:36:04,145 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> 
<Jul 27, 2018, 3:36:04,238 PM CST> <Warning> <Server> <BEA-002611> <The hostname "localhost", maps to multiple IP addresses: 127.0.0.1, 0:0:0:0:0:0:0:1.> 
<Jul 27, 2018, 3:36:04,249 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,314 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 10.0.2.15:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,315 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,397 PM CST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.> 
<Jul 27, 2018, 3:36:04,399 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 192.168.122.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,400 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,400 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 10.0.2.15:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,401 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[3]" is now listening on 0:0:0:0:0:0:0:1%lo:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,401 PM CST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 192.168.122.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
<Jul 27, 2018, 3:36:04,407 PM CST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> 
<Jul 27, 2018, 3:36:04,420 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> 

使用http://127.0.0.1:7001/console可以访问登录界面:
这里写图片描述
此时虽然没有安装TimesTen,但在WebLogic中可以看到TimesTen数据库的条目:
这里写图片描述

安装TimesTen

使用timesten用户安装TimesTen 服务器

如果用户已经安装了TimesTen服务器,则此步骤可以省略,不过我们是一个单机的完整测试环境,因此我们需要安装TimesTen作为目标数据源。

# groupadd oinstall
# useradd -g oinstall timesten
# passwd timesten
# mkdir /etc/TimesTen
# chmod 775 /etc/TimesTen
# chgrp oinstall /etc/TimesTen
$ su - timesten
$ tar -zxvf /tmp/timesten112280.linux8664.tar.gz -C .
$ cd linux8664/
$ ./setup.sh 

NOTE: Each TimesTen installation is identified by a unique instance name.
      The instance name must be a non-null alphanumeric string, not longer
      than 255 characters.

Please choose an instance name for this installation? [ tt1122 ] 
Instance name will be 'tt1122'.
Is this correct? [ yes ] 

Of the three components:

  [1] Client/Server and Data Manager
  [2] Data Manager Only
  [3] Client Only
... 下略

安装完成后,创建测试数据库TT_1122:

$ ttisql TT_1122
Command> create user ttuser identified by timesten;
User created.
Command> grant create session to ttuser;
Command> exit

测试使用ttuser登录数据库成功:

$ ttisql "uid=ttuser;pwd=timesten;dsn=TT_1122"

Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
connect "uid=ttuser;pwd=********;dsn=TT_1122";
Connection successful: DSN=TT_1122;UID=ttuser;DataStore=/home/timesten/TimesTen/tt1122/info/TT_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/timesten/TimesTen/tt1122/lib/libtten.so;TypeMode=0;
(Default setting AutoCommit=1)
Command> 

为WebLogic安装TimesTen 客户端

这是最关键的一步,也是必须的一步。安装用户为weblogic。
将WebLogic加入oinstall组在生产环境不是必须的,但在我们的单机环境中,只有这样做才能让其访问/etc/TimesTen目录,以写入注册表信息。

$ id
uid=1003(weblogic) gid=1003(weblogic) groups=1003(weblogic)
$ tar -zxvf /tmp/timesten112280.linux8664.tar.gz -C .
# usermod -G oinstall weblogic
# id weblogic
uid=1003(weblogic) gid=1003(weblogic) groups=1003(weblogic),1004(oinstall)

开始安装,主要只需安装客户端软件:

$ cd linux8664/
[weblogic@localhost linux8664]$ ./setup.sh 

There is 1 TimesTen instance installed locally :

1) tt1122 (TimesTen11.2.2.8)

Of the following options :

  [1] Install a new instance
  [2] Upgrade an existing instance
  [3] Display information about an existing instance
  [q] Quit the installation

Which would you like to perform? [ 1 ] 

* The default instance name 'tt1122' is in use.

NOTE: Each TimesTen installation is identified by a unique instance name.
      The instance name must be a non-null alphanumeric string, not longer
      than 255 characters.

Please choose an instance name for this installation? [  ] ttclient
Instance name will be 'ttclient'.
Is this correct? [ yes ] 

Of the three components:

  [1] Client/Server and Data Manager
  [2] Data Manager Only
  [3] Client Only

Which would you like to install? [ 1 ] 3

Of the following options :

  [1] /home/weblogic
  [2] /home/weblogic/tmp
  [3] Specify a location
  [q] Quit the installation

Where would you like to install the ttclient instance of TimesTen? [ 1 ] 
... 下略

在客户端创建DSN以指向TimesTen服务器上的TT_1122条目:

$ cat $TT_HOME/info/sys.odbc.ini

[ODBC Data Sources]
TT_1122CS=TimesTen 11.2.2 Client Driver

[TT_1122CS]
TTC_SERVER=localhost.localdomain
TTC_SERVER_DSN=TT_1122
...

然后测试可以连通到目标TimesTen数据库:

$ ttisqlcs "uid=ttuser;pwd=timesten;dsn=TT_1122CS"

Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.



connect "uid=ttuser;pwd=********;dsn=TT_1122CS";
Connection successful: DSN=TT_1122CS;TTC_SERVER=localhost.localdomain;TTC_SERVER_DSN=TT_1122;UID=ttuser;DATASTORE=/home/timesten/TimesTen/tt1122/info/TT_1122;DATABASECHARACTERSET=US7ASCII;CONNECTIONCHARACTERSET=US7ASCII;TYPEMODE=0;
(Default setting AutoCommit=1)
Command> 

在WebLogic中配置数据源

使用weblogic用户安装TimesTen客户端实际上添加了TimesTen的驱动,这些驱动的核心就是ttjdbc*.jar。为了能定位到这些驱动,需要设置环境变量,TimesTen自带的脚本ttenv.sh可以完成这些工作。可以将此脚本加入操作系统用户启动脚本中,如.bash_profile,或是WebLogic启动脚本中,总之,需要重启WebLogic。
在重启的过程中,需要观察CLASSPATH和PATH环境变量,可以看到ttjdbc5.jar已经在路径中

$ ./startWebLogic.sh 
.
.
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000
.
CLASSPATH=/usr/java/jdk1.8.0_172-amd64/lib/tools.jar:/home/weblogic/oracle/wlserver/server/lib/weblogic.jar:/home/weblogic/oracle/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b3/lib/ant-contrib.jar:/home/weblogic/oracle/wlserver/modules/features/oracle.wls.common.nodemanager.jar::/home/weblogic/oracle/wlserver/common/derby/lib/derbynet.jar:/home/weblogic/oracle/wlserver/common/derby/lib/derbyclient.jar:/home/weblogic/oracle/wlserver/common/derby/lib/derby.jar:/home/weblogic/TimesTen/ttclient/lib/ttjdbc5.jar:/home/weblogic/TimesTen/ttclient/lib/orai18n.jar:/home/weblogic/TimesTen/ttclient/lib/timestenjmsxla.jar:/home/weblogic/TimesTen/ttclient/3rdparty/jms1.1/lib/jms.jar:.
.
PATH=/home/weblogic/domain/bin:/home/weblogic/oracle/wlserver/server/bin:/home/weblogic/oracle/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/usr/java/jdk1.8.0_172-amd64/jre/bin:/usr/java/jdk1.8.0_172-amd64/bin:/home/weblogic/TimesTen/ttclient/bin:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/oci:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/odbc:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/odbc/xla:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/jdbc:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/odbc_drivermgr:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/proc:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/ttclasses:/home/weblogic/TimesTen/ttclient/quickstart/sample_code/ttclasses/xla:/home/weblogic/TimesTen/ttclient/ttoracle_home/instantclient_11_2:/home/weblogic/TimesTen/ttclient/ttoracle_home/instantclient_11_2/sdk:/home/weblogic/TimesTen/ttclient/3rdparty/ant/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/weblogic/.local/bin:/home/weblogic/bin
...

登录WebLogic界面,建立一个数据源,类型为Generic Data Source:
这里写图片描述
在第一步中, Name和JNDI Name都是逻辑名,无关紧要。而Database Type需要选TimesTen Client:
这里写图片描述
第二步,Database Driver选不带XA的那个:
这里写图片描述
第三步选择默认,略过。
第四步输入用户名和口令以及DSN:
这里写图片描述
最后一步不需要输入什么,直接测试即可:
这里写图片描述
成功了,保存退出。

总结

WebLogic中配置TimesTen数据源非常简单,大致步骤为:

  1. 安装TimesTen客户端
  2. 设置环境变量,并加入操作系统用户启动脚本或WebLogic启动脚本中
  3. 在TimesTen客户端中,建立指向目标数据源的DSN
  4. 没有了,就这些

示例文件

# tail ~timesten/.bash_profile
...
TT_HOME=/home/timesten/TimesTen/tt1122
export TT_HOME
. $TT_HOME/bin/ttenv.sh

# tail ~weblogic/.bash_profile
...
TT_HOME=/home/weblogic/TimesTen/ttclient
export TT_HOME
. $TT_HOME/bin/ttenv.sh

# cat /etc/TimesTen/instance_info 
#SUM 40057     1
[ tt1122 ]
Product=TimesTen11.2.2.8.0
InstallDir=/home/timesten/TimesTen/tt1122
InstanceAdministrator=timesten
DaemonHome=/home/timesten/TimesTen/tt1122/info
BitLevel=64
Component=Client/Server and DataManager
TT_PORT=53396

[ ttclient ]
Product=TimesTen11.2.2.8.0
InstallDir=/home/weblogic/TimesTen/ttclient
InstanceAdministrator=weblogic
DaemonHome=/home/weblogic/TimesTen/ttclient/info
BitLevel=64
Component=Client

参考

猜你喜欢

转载自blog.csdn.net/stevensxiao/article/details/81237983