Archive for the ‘shell,perl,python,lex,yacc,c’ Category
星期五, 十一月 6th, 2009
oracle调用c函数(续)
本来挺简单的问题,可惜我们系统安装的有问题。
oracle是64位的,而gcc是32位的。
这样在调用的过程会报错误。
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: ld.so.1: extproc: fatal:
/opt/oracle/products/10.2.0/lib/sunwg.so: wrong ELF class: ELFCLASS32
ORA-06512: at "ETL.H_EXECUTE_CMD", line 1
重装64位的gcc也是个麻烦事。
从网上查了半天终于发现个好办法。
修改LD_LIBRARY_PATH=/opt/oracle/products/10.2.0/lib为
LD_LIBRARY_PATH=/opt/oracle/products/10.2.0/lib32
这样调用32位的oracle lib库。
重新启动listener。
搞定。
><
Posted in linux and unix, oracle, shell,perl,python,lex,yacc,c | No Comments »
星期五, 十一月 6th, 2009
今天处理同事的问题,顺便学习了从oracle调用c函数的方法。
1,修改listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC32))
(ADDRESS = (PROTOCOL = TCP)(HOST =sunwg)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/products/10.2.0)
(PROGRAM = /opt/oracle/products/10.2.0/bin/extproc)
)
(SID_DESC =
(SID_NAME = sunwg)
(ORACLE_HOME = /opt/oracle/products/10.2.0)
(GLOBAL_DBNAME ...
Posted in oracle, shell,perl,python,lex,yacc,c | No Comments »
星期三, 十一月 4th, 2009
C通过freetds接口访问SQL SERVER数据库
代码举例如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include </usr/local/freetds/include/sybfront.h>
#include </usr/local/freetds/include/sybdb.h>
int main(void)
{
char szUsername[32] = "robit";
char szPassword[32] = "littlerobit";
char szDBName[32] = "shxn";
char szServer[32] = "10.16.14.67:1433";
//初始化db-library
dbinit();
//连接数据库
LOGINREC *loginrec = dblogin();
DBSETLUSER(loginrec, szUsername);
DBSETLPWD(loginrec, szPassword);
DBPROCESS *dbprocess = dbopen(loginrec, szServer);
if(dbprocess == FAIL)
{
printf("ASB>>Conect MS SQL SERVER fail\n");
...
Posted in linux and unix, shell,perl,python,lex,yacc,c | No Comments »
星期四, 九月 24th, 2009
124 EMEDIUMTYPE Wrong medium type
123 ENOMEDIUM No medium found
122 EDQUOT Disk quota exceeded
121 EREMOTEIO Remote I/O error
120 EISNAM ...
Posted in shell,perl,python,lex,yacc,c | No Comments »
星期三, 九月 23rd, 2009
管道效率测试
管道技术是Linux的一种基本的进程间通信技术。
由于不产生中间文件,效率会更好一些。
下面以字符集转化为例测试实际中管道对效率的提升
实现目标:
1,将文件0_gbk.dat由gbk转化为utf8
2,将前一步的文件从utf8转化为gbk
例一,不使用管道
[oracle@dw_testdb sunwg]$ time iconv -f gbk -t utf8 0_gbk.dat > 0_utf8.dat
real 0m50.347s
user 0m14.114s
sys 0m5.433s
[oracle@dw_testdb sunwg]$ time iconv -t gbk -f utf8 0_utf8.dat > 1_gbk.dat
real 0m53.732s
user 0m13.147s
sys 0m5.167s
total= 50.347 + 53.732 ...
Posted in shell,perl,python,lex,yacc,c | No Comments »