posts - 33, comments - 46, trackbacks - 0, articles - 2

已经有一段时间了,经过半天时间的多次尝试,还是没能在redhat EL6上面安装成功oracle 10g,虽然说该版本的oracle没有在经过redhat el6的认证,但是网络上还是可以找到不少相关的文章好像是可以安装成功的,不过通过这次尝试,也获得不少相关当面的经验,那就是接下来重装为CentOS5.5,然后安装Oracle 10g,一次成功,1个小时内完成,呵呵。

接下来再记录一下相关的一些资料

posted @ 2011-12-28 11:59 在路上... 阅读(286) | 评论 (0)编辑 收藏

为了安装软件包方便,通常需要配置使用yum来安装,或者在机房里面,不能使用互联网的时候,不希望使用rpm来安装,如何配置等等问题,为了方便以后使用,记录下备忘:

1、基于ISO安装包的repo配置

首先需要将iso文件mount起来,可以使用mount –o loop /FILE_TO_DVD.iso /mnt/cdrom

进入yum repo目录:/etc/yum.repos.d,编辑一个文件iso.repo

[root@linux yum.repos.d]# cat iso.repo
[iso]
name=iso
baseurl=file:///mnt/cdrom
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-beta
gpgcheck=0

把原来的文件CentOS-Base.repo  CentOS-Media.repo可以加个.bak扩展名备份一下。
或者可以使用参数
yum --disablerepo=* --enablerepo=iso
控制不同的repo使用

接下来安装软件就可以方便的使用类似这样的命令安装了
yum install glibc

使用yum list可以测试一下是否包含了刚才的软件库,或者可以使用'yum clean all' 清除metadata

2、配置yum代理

可以修改/etc/yum.conf 文件,加入:

# 代理服务器 - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# 用于 yum 连接的帐户细节
proxy_username=yum-user
proxy_password=pass

或者可以通过环境变量加入当前用户的全局代理,可以修改.bash_profile文件:

http_proxy="http://yum-user:qwerty@mycache.mydomain.com:3128"
export http_proxy

posted @ 2011-12-28 11:50 在路上... 阅读(347) | 评论 (0)编辑 收藏

测试发帖,直接粘贴图片看看效果如何!

image

posted @ 2011-07-30 09:31 在路上... 阅读(247) | 评论 (0)编辑 收藏

通过下面方式可以发布jboss的naming服务
<?xml version="1.0" encoding="UTF-8"?>
<server>
  
<mbean code="org.jboss.naming.NamingService" 
         name
="DefaultDomain:service=Naming">
    
<attribute name="Port">1099</attribute>
  
</mbean>
</server>


同时也可以独立使用,你需要jnpserver.jarlog4j.jar 文件,
 # Use a ConsoleAppender -- write log data to standard out
log4j.rootLogger
=DEBUG, A1
log4j.appender.A1
=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout
=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern
=%-4r [%t] %-5p %c %x - %m%n


配套的log4j配置文件,使用下面命令启动java org.jnp.server.Main,启动之后,jndi客户端需要jnp-client.jar文件来连接
java.naming.provider.url=jnphost.mycompany.com:1099
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming
连接参数如上



posted @ 2011-06-20 11:23 在路上... 阅读(358) | 评论 (0)编辑 收藏

     摘要: 通常,如果需要在应用中使用tomcat的jndi数据源,需要修改context配置,例如 <?xml version="1.0" encoding="UTF-8"?> <Context path="/app" docBase="E:\appweb">   <Resource name="jnd...  阅读全文

posted @ 2011-01-02 17:36 在路上... 阅读(12287) | 评论 (0)编辑 收藏

通过jconsole可以远程监控web应用服务器,可以在启动参数中加上

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

posted @ 2011-01-02 17:14 在路上... 阅读(842) | 评论 (0)编辑 收藏

参考:http://blog.csdn.net/horsefaced/archive/2007/08/16/1746888.aspx

这个异常源自于oracle驱动面对一个数值型的返回字段时,在得到指定的字段小数点右边的数值数量时(Gets the designated column's number of digits to right of the decimal point.这个是原文),居然会返回-127,而oracle本身的cacheRowSet实现不允许这种情况出现,于是就会报标题所说的异常。

对于一般的做法,需要修改很多地方,包括ResultSet的decorate类,还有Spring的SqlRowSetResultSetExtractor

所谓头痛医头,脚痛医脚,这里提供一种方法直接从oracle jdbc驱动入手,彻底从源头上修改掉该问题:
反编译ojdbc14.jar(Oracle 9i驱动为例)

package oracle.jdbc.driver;

public class OracleResultSetMetaData


目标方法:
public int getScale(int paramInt)
    throws SQLException
  {
    int i = getValidColumnIndex(paramInt);
    return this.statement.getDBDescription()[i].scale;
  }

使用javassist编写一段代码:
 public  void crackOracleDriver() {
        ClassPool pool 
= ClassPool.getDefault();
        
try {
            pool.insertClassPath(
"E:\\allproject\\bpmtrans\\lib\\ojdbc14.jar");
            CtClass cc 
= pool.get("oracle.jdbc.driver.OracleResultSetMetaData");
            System.out.println(cc);
            CtClass[] param 
= new CtClass[1] ;
            param[
0]=pool.get("int");
            CtMethod a 
= cc.getDeclaredMethod("getScale",param);
            System.out.println(a);
            a.setBody(
"{int i = getValidColumnIndex($1);\n" +
                    
"    int res=statement.getDBDescription()[i].scale;\n" +
                    
"return res<0?0:res; }");
            cc.writeFile(
"c:\\");

        }
 catch (Exception e) {
            e.printStackTrace();
        }

    }

将生成的class置换原来的class,大功告成!

这个所谓的精度,一般来说,修改了应该没有多大问题的

posted @ 2009-10-09 17:18 在路上... 阅读(1849) | 评论 (1)编辑 收藏

首先,下载openssl安装,windows环境从http://www.openssl.org/related/binaries.html下载。
我这里测试下载的版本是:http://www.slproweb.com/download/Win32OpenSSL-0_9_8h.exe
安装完成之后,修改bin目录下面的openssl.cfg为openssl.cnf,在请求证书时需要用到这个配置文件,生成证书,为了方便,编写了下面的批处理文件,供参考:


@echo off
echo 
1.CA 创建一个 RSA 私用密钥
openssl genrsa 
-out %1.key 1024 

echo.
echo 
2.利用 CA 的 RSA 密钥创建一个自签署的 CA 证书(X.509结构)
openssl req 
-new -x509 -days 36500 -key %1.key -out %1.crt -subj /C=CN/ST=GuangDong/L=GuangZhou/O=SinoTech/OU=CA-SinoTech

echo.
echo 
3.CA 创建一个 服务端 RSA 私用密钥
openssl genrsa 
-out %2.key 1024 
echo.

echo 
4.创建服务端签署请求 CSR
openssl req 
-new -key %2.key -out %2.csr -subj "/C=CN/ST=GuangDong/L=GuangZhou/O=SinoTech/OU=Serv-SinoTech/CN=SinoTech Weblogic Server"

echo.
echo 
5.签署证书
rem 准备一些默认文件、目录,否则运行时会报错
if exist "%cd%\newcerts" goto got1
md newcerts
:got1

if exist "%cd%\index.txt" goto got2
echo tmp 
>_tmp
del _tmp 
>index.txt
:got2

if exist "%cd%\serial" goto got3
echo AD 
>serial
:got3

openssl ca 
-in %2.csr -out %2.crt -cert %1.crt -keyfile %1.key 
echo.
echo 处理完成
pause

运行批处理
genca.cmd [CA证书名] [服务端证书名]
例如genca.cmd ca server

通过上面命令,会生成server.crt,server.key,然后将上面参数加到tomcat的配置中就可以使用SSL连接方式访问网站应用了
<Connector 
           
port="8443" minSpareThreads="5" maxSpareThreads="75"
           enableLookups
="true" disableUploadTimeout="true" 
           acceptCount
="100"  maxThreads="200"
           scheme
="https" secure="true" SSLEnabled="true"
           SSLCertificateFile
="C:\apache-tomcat-6.0.16\conf\server.crt" 
           SSLCertificateKeyFile
="C:\apache-tomcat-6.0.16\conf\server.key"
           clientAuth
="false" sslProtocol="TLS"/>

posted @ 2008-07-18 12:40 在路上... 阅读(5812) | 评论 (3)编辑 收藏

  个人知识管理的29个原则

1持续的学习成为个人生存和发展的基础。持续学习不一定能带来成功,但不学习一定失败; 

2信息和知识爆炸,在一段时间和时期内,学习的内容必须聚焦。起码要在一个领域内成为专家。 

3你应该学习的内容取决于你的价值观、特长、个性和目标。

4、你必须学会如何有效的评估信息和知识,所以你必须根据你的价值观、特长、个性和目标确立自己对信息和知识的“过滤器”;

5、人是知识获取的重要渠道,所以你应该知道谁最擅长什么?遇到问题时知道可以向谁学习和请教;

6、你牛了你的朋友也一定牛,建立人际资源的基础是自己的知识基础、个性和激情、自己优势的合理展示和帮助别人的意愿;

7、人际关系需要维护;捷径是找到那些愿意共享自己朋友资源的人,你也应该做这样的人;

8、信息如果不经过处理,不能称为知识。所以你存储的知识起码你应该简单看过、知道是在讲什么;

9、信息和知识存储前应该尽可能做规范化的工作,例如你做的摘要、感触、觉得最有价值的部分、将来能做什么用等等;

10、建立自己的分类字典,而不是每次想起什么就建立什么样的文件夹或者标签。分类字典,持之以恒坚持,适当调整;

11、知识存储中分类不宜过宽,过宽则等于没有分类;分类不宜过深,过深后你就不会再去看;

12、充分利用各种工具,尤其是web2.0工具做知识存储和获取工作;

13知识存储时适当共享,听取和收集别人的意见和建议;

14有意识的做知识显性化的工作,既方便知识传播也促进知识学习和建立人际网络;

15知识传播中必须考虑传播的方式和效率;

16不能用简单朴素的语言表述的知识证明你还没有深入理解;

17多用举例子、讲故事的方法传播你的知识、见解。这个过程是你对知识的再深化过程;

18你的知识传播的越广,你的影响力越大;

19你的目的决定了你知识利用的方式。如果目的是要写论文,则你的知识就是明确、简洁的表达;如果是想要在市场上销售,就必须产品化、规范化或者专利化;

20知识本身没有价值,只有被利用时才能展现其价值;

21知识必须跟任务、项目结合起来才能发挥作用;

22单独的一个主题的知识很难被很好的利用,所以你必须将你的知识融入团队中或者找到自己的合作伙伴;

23知识创新最简单的方法是总结和分析;

24知识创新是一种习惯;

25学习或者实践---总结----将总结出来的内容投入实践检验和请行家批评—继续总结和实践;

26不能光做,还要思考;

27个人竞争力的源泉不是你现在知道的或者掌握的,而是你选择方向和快速学习的能力,是你能够将知识用足用好的能力;

28环境造就人,太安逸的环境对个人的发展弊大于利。如果不能找到好的环境,那就自己给自己压力;

29、既要会做,也要会展示自己做的,要有树立个人品牌意识。

posted @ 2008-06-21 16:07 在路上... 阅读(323) | 评论 (0)编辑 收藏

一般的数据库中,DATE字段仅仅表示日期,不包括日期信息,而Oracle数据库中的DATE数据类型是包括日期、时间的,对于不同的Oracle jdbc驱动版本,对于该问题的处理都有些区别,如果你使用9i或者11g
的驱动程序,可能不会发现什么困惑,不幸的话,你使用Oracle10g的JDBC驱动,问题就来了,你会发现时间不见了
看下面的程序
• 表结构如下
create table t_test(
id int,
date1 date,
date2 timestamp,
primary key(id)
)

 1try {
 2            Class.forName("oracle.jdbc.OracleDriver");
 3            java.sql.Connection connection1 = DriverManager.getConnection("jdbc:oracle:thin:@192.168.8.200:1521:cdb""sysusr""sys");
 4            System.out.println(connection1);
 5            System.out.println(connection1.getMetaData().getDriverName()+" "+connection1.getMetaData().getDriverVersion());
 6            ResultSet rs = connection1.createStatement().executeQuery("select date1,date2 from t_test");
 7            rs.next();
 8             printInfo(rs,1);
 9            printInfo(rs,2);
10        }

11        catch (Exception exception1) {
12            exception1.printStackTrace();
13        }

14
15
16public static void printInfo(ResultSet rs,int i) throws SQLException{
17        ResultSetMetaData meta=rs.getMetaData();
18        System.out.printf("Colname=%s,Type=%s,TypeName=%s,val=[%s];\n",meta.getColumnName(i),meta.getColumnType(i),meta.getColumnTypeName(i),rs.getObject(i).toString());
19    }

• 如果使用9i或者11g的驱动连接数据库,返回结果如下:
9i数据库JDBC
oracle.jdbc.driver.OracleConnection@16930e2
Oracle JDBC driver 9.2.0.8.0
Colname=DATE1,Type=91,TypeName=DATE,val=[2008-06-13 13:48:21.0];
Colname=DATE2,Type=93,TypeName=TIMESTAMP,val=[oracle.sql.TIMESTAMP@18d107f];

11g数据库JDBC
oracle.jdbc.driver.T4CConnection@a61164
Oracle JDBC driver 11.1.0.6.0-Production+
Colname=DATE1,Type=93,TypeName=DATE,val=[2008-06-13 13:48:21.0];
Colname=DATE2,Type=93,TypeName=TIMESTAMP,val=[oracle.sql.TIMESTAMP@c4aad3];

如果使用10g JDBC驱动,结果如下:
oracle.jdbc.driver.T4CConnection@1bac748
Oracle JDBC driver 10.2.0.2.0
Colname=DATE1,Type=91,TypeName=DATE,val=[2008-06-13];
Colname=DATE2,Type=93,TypeName=TIMESTAMP,val=[oracle.sql.TIMESTAMP@b8df17];

结果是让人困惑,时间怎么不见了?

对于该问题,在Oracle的JDBC FAQ中有提到解决办法:
Prior to 9.2, the Oracle JDBC drivers mapped the DATE SQL type to java.sql.Timestamp. This made a certain amount of sense because the Oracle DATE SQL type contains both date and time information as does java.sql.Timestamp. The more obvious mapping to java.sql.Date was somewhat problematic as java.sql.Date does not include time information. It was also the case that the RDBMS did not support the TIMESTAMP SQL type, so there was no problem with mapping DATE to Timestamp. 

In 9.2 TIMESTAMP support was added to the RDBMS. The difference between DATE and TIMESTAMP is that TIMESTAMP includes nanoseconds and DATE does not. So, beginning in 9.2, DATE is mapped to Date and TIMESTAMP is mapped to Timestamp. Unfortunately if you were relying on DATE values to contain time information, there is a problem. 

There are several ways to address this problem: 

Alter your tables to use TIMESTAMP instead of DATE. This is probably rarely possible, but it is the best solution when it is. 

Alter your application to use defineColumnType to define the columns as TIMESTAMP rather than DATE. There are problems with this because you really don't want to use defineColumnType unless you have to (see What is defineColumnType and when should I use it?). 

Alter you application to use getTimestamp rather than getObject. This is a good solution when possible, however many applications contain generic code that relies on getObject, so it isn't always possible. 

Set the V8Compatible connection property. This tells the JDBC drivers to use the old mapping rather than the new one. You can set this flag either as a connection property or a system property. You set the connection property by adding it to the java.util.Properties object passed to DriverManager.getConnection or to OracleDataSource.setConnectionProperties. You set the system property by including a -D option in your java command line. 

  java -Doracle.jdbc.V8Compatible="true" MyApp


参照上面的解释,修改代码如下可以解决10g JDBC驱动的问题:
try {
            Class.forName(
"oracle.jdbc.OracleDriver");
            Properties prop
=new Properties();
            prop.setProperty(
"user","sysuser");
            prop.setProperty(
"password","sys");
            prop.setProperty(
"oracle.jdbc.V8Compatible","true");
            java.sql.Connection connection1 
= DriverManager.getConnection("jdbc:oracle:thin:@192.168.8.200:1521:cdb"
, prop);
            System.out.println(connection1);
            System.out.println(connection1.getMetaData().getDriverName()
+" "+connection1.getMetaData().getDriverVersion());
            ResultSet rs 
= connection1.createStatement().executeQuery("select date1,date2 from t_test");
            rs.next();
            printInfo(rs,
1);
            printInfo(rs,
2);
        }

        
catch (Exception exception1) {
            exception1.printStackTrace();
        }
或者在系统变量中使用参数-Doracle.jdbc.V8Compatible="true",例如
java -Doracle.jdbc.V8Compatible="true" MyApp

结果如下:
oracle.jdbc.driver.T4CConnection@9664a1
Oracle JDBC driver 10.2.0.2.0
Colname=DATE1,Type=93,TypeName=DATE,val=[2008-06-13 13:48:21.0];
Colname=DATE2,Type=93,TypeName=DATE,val=[oracle.sql.TIMESTAMP@1172e08];

posted @ 2008-06-13 14:19 在路上... 阅读(6957) | 评论 (9)编辑 收藏

仅列出标题
共4页: 上一页 1 2 3 4 下一页