informix数据库常用的命令

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xukaixun005/article/details/81872091

1、启停数据库服务

    1.1、启动informix命令:

        oninit -vy

    1.2、停止informix命令:

       onmode -ky

2、锁定表解锁

    2.1、查出sid:

  select a.tabname,username ,sid,waiter,dbsname,tabname,rowidlk,keynum,type from sysmaster:syslocks    a,sysmaster:syssessions b where b.sid=a.owner and a.tabname!='informix.tfa_gaia_rule_xml';

    2.2、根据sid解锁表:

        获得SID名称,一般为4位数字,然后进入Informix数据库服务器,
        执行命令行:>onmode -z sid

        

3、BLOB类型数据操作

    3.1、定义存储空间:

    onspaces -c -S mydatasbsp -p /opt/IBM/informix/data/db_sb_infomix.dat -o 0 -s 100000

    3.2、建表,给BLOB类型字段绑定存储地址:

    alter table tfa_gaia_rule_file put rule_content in (mydatasbsp);

    3.3、通过FILETOBLOB函数插入BLOB类型数据

 update tfa_gaia_rule_file set rule_content=FILETOBLOB('/opt/IBM/informix/ol_informix1170_1.log','server') where ser_file_id=-1971607794

4、查询数据

    4.1、查询前10条数据
        select first 10 alarm_title_text from tfa_alarm_clr

    4.2、查询从10到200条数据
        select skip 10 limit 200  alarm_title_text from tfa_alarm_clr

5、查询报错乱码:The error "Encoding or code set not supported" 

在JDBC3.50JC4X1版本后,JDBC提供了一个选项,可以让用户选择遇到非法字符集时采用跟以前兼容的处理方式,具体方法为是在JDBC的链接url中,加入“IFX_USE_STRENC=true”的选项,这样JDBC在遇到非法字符集时,就会将其转换为"?",并将其插入数据库中。例如;
"jdbc:informix-sqli://inst:port:dbname:informixserver=XXX;user=informix;password=XX;DB_LOCALE=en_us.819;IFX_USE_STRENC=true;";
对于使用WAS连接数据库的用户,需要手工添加一个连接属性ifxIFX_USE_STRENC,并将其值设置为true,就可以了

猜你喜欢

转载自blog.csdn.net/xukaixun005/article/details/81872091