如何在linux环境下调试java程序使用访问timesten:-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 2090740
  • 博文数量: 195
  • 博客积分: 4378
  • 博客等级: 上校
  • 技术积分: 4046
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-09 11:37
个人简介

白天和黑夜只交替没交换无法想像对方的世界

文章分类

全部博文(195)

文章存档

2014年(3)

2013年(20)

2012年(18)

2011年(107)

2010年(17)

2009年(5)

2008年(20)

2007年(5)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2012-03-08 23:59:38

一.如何在linux环境下调试java程序使用访问timesten:

1.配置jdk环境变量:

上传jdk-6u7-linux-i586.bin文件到/data0/目录下,执行如下命令:
[root@ora11gr2 data0]#chmod 777 jdk-6u7-linux-i586.bin
[root@ora11gr2 data0]#./jdk-6u7-linux-i586.bin
[root@ora11gr2 data0]# ln -sn /data0/jdk1.6.0_07/ /usr/java    前面为源,后面为目的
[root@ora11gr2 data0]# vim /etc/profile 
在文件最后,添加如下三行:
export java_home=/data0/jdk1.6.0_07
export classpath=.:$java_home/lib:$java_home/jre/lib
export path=/usr/java/bin:$path

[root@ora11gr2 data0]# source /etc/profile

timesten用户环境变量文件~/.bash_profile下添加如下几行:
[timesten@ora11gr2 ~]$ vim  ~/.bash_profile
#add timsten env
export  oracle_sid=mytest
export  nls_lang=american_america.zhs16gbk
export oracle_home=/app/oracle/product/11.2.0/db_1
export tt_home=/data0/timesten/timesten/tt1122
export tns_admin=/app/oracle/product/11.2.0/db_1/network/admin
export classpath=/data0/timesten/timesten/tt1122/lib/ttjdbc5.jar:/app/oracle/product/11.2.0/db_1/jdbc/lib/ojdbc5.jar:$classpath
export path=/data0/timesten/timesten/tt1122/bin/:$oracle_home/bin:$path
export ld_library_path=$oracle_home/lib:/usr/lib:$oracle_home/network/lib:/data0/timesten/timesten/tt1122/lib:$ld_library_path

[timesten@ora11gr2 ~]$ javac
usage: javac
where possible options include:
  -g                         generate all debugging info
  -g:none                    generate no debugging info
  -g:{lines,vars,source}     generate only some debugging info
  -nowarn                    generate no warnings
  -verbose                   output messages about what the compiler is doing
  -deprecation               output source locations where deprecated apis are used
  -classpath           specify where to find user class files and annotation processors
  -cp                  specify where to find user class files and annotation processors
  -sourcepath          specify where to find input source files
  -bootclasspath       override location of bootstrap class files
  -extdirs             override location of installed extensions
  -endorseddirs        override location of endorsed standards path
  -proc:{none,only}          control whether annotation processing and/or compilation is done.
  -processor [,,...]names of the annotation processors to run; bypasses default discovery process
  -processorpath       specify where to find annotation processors
  -d              specify where to place generated class files
  -s              specify where to place generated source files
  -implicit:{none,class}     specify whether or not to generate class files for implicitly referenced files
  -encoding        specify character encoding used by source files
  -source           provide source compatibility with specified release
  -target           generate class files for specific vm version
  -version                   version information
  -help                      print a synopsis of standard options
  -akey[=value]              options to pass to annotation processors
  -x                         print a synopsis of nonstandard options
  -j                   pass directly to the runtime system

[timesten@ora11gr2 ~]$ javac -version
javac 1.6.0_07

2.编写java测试代码:

[timesten@ora11gr2 ~]$ cat tttest.java
import java.sql.*;
import javax.sql.*;
public class tttest{
public static void main(string args[])
{
//string url = "jdbc:timesten:client:dsn=lujgcs_1122"; remote connect strings
string url = "jdbc:timesten:direct:dsn=lujg_1122";

connection con = null;
try {
class.forname("com.timesten.jdbc.timestendriver");
}
catch (classnotfoundexception ex)
{ex.printstacktrace();
}
try {
con = drivermanager.getconnection(url);
system.out.println("connected");
java.sql.statement st=con.createstatement();
java.sql.resultset rs=st.executequery("select * from test");
while (rs.next())
{
system.out.println(rs.getstring("id"));
}

con.close();
} catch (sqlexception ex) {
ex.printstacktrace();}
}
}

编译程序:

[timesten@ora11gr2 ~]$ javac tttest.java
[timesten@ora11gr2 ~]$ ll
-rw-r--r-- 1 timesten oinstall 1395 mar  8 10:13 tttest.class
-rwxr-xr-x 1 timesten oinstall  715 mar  8 10:13 tttest.java

查看执行结果:

[timesten@ora11gr2 ~]$ java tttest
connected
100
200
300

阅读(5397) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

十七岁的回忆2012-03-12 07:15:48

这全是调试的过程么

|

忘忧草5552012-03-11 14:23:01

环境变量的设置是个最基本的

|
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图