TimesTen 使用ODBC连接数据库的程序问题
程序背景介绍
TimesTen 7.0.5在Linux 64位平台上, 程序运行后 等待学生输入自己的名字和系名,然后插入数据库,并返回目前数据库中所有的学生以及对应的系。
创建一个DataStore,范例中使用的DSN为 ttodbc,下面是在我的平台上的DSN,可以对照你自己的环境进行修改。
[ttodbc]
Driver=/home/tt705/TimesTen/tt705/lib/libtten.so
DataStore=/home/tt705/datastore/ttodbc
LogDir=/home/tt705/log
DatabaseCharacterSet=ZHS16GBK
PermSize=12
TempSize=12
*
在ttodbc中创建要使用的表以及Sequence
create table student(
id integer not null primary key,
name varchar(80),
department varchar(80) not null
);
CREATE SEQUENCE studentID INCREMENT BY 1;
* Makefile 文件
#
#
# TimesTen ODBC exapmle
#
INSTDIR = /home/tt705/TimesTen/tt705
COMMDIR = $(INSTDIR)/demo/common
CC = gcc
PLATCFLAGS = -Os -finline-functions
LDFLAGS =
INCS = -I$(INSTDIR)/include -I$(COMMDIR) -I$(INSTDIR)/include/ttclasses
CSDEFS = -DTTCLIENTSERVER
CFLAGS = $(PLATCFLAGS) $(INCS)
TTLINK = -L$(INSTDIR)/lib -Wl,-rpath,$(INSTDIR)/lib
DCLIBS = $(TTLINK) -ltten $(EXTRALIBS)
CSLIBS = $(TTLINK) -lttclient $(EXTRALIBS)
#BLKINSDC = ttodbc
#BLKINSDCOBJS = ttodbc.o
#PROGS = $(BLKINSDC)
all: ttodbc
ttodbc: ttodbc.o
$(CC) -o ttodbc $(LDFLAGS) ttodbc.o $(DCLIBS)
clean:
rm -f ttodbc.o
#
# .o files
#
ttodbc.o: ttodbc.c
$(CC) $(CFLAGS) -c ttodbc.c
[color=#FF0000]ttobc.c源文件[/color]请参加附件
程序运行后出现的问题是:
Successfully ini environment...
Preparing insert...
ID :1
Name :tao
Department :computer
Inserting...
*** ERROR in ttodbc.c, line 112: Unable to inserting
*** ERROR in ttodbc.c, line 114: Unable to commit inserting
*** ERROR in ttodbc.c, line 118: Unable to free the insert statement handle
*** [TimesTen][TimesTen 7.0.5.0.0 ODBC Driver]Function sequence error
*** ODBC Error/Warning = S1010, TimesTen Error/Warning = 0
Inserting done.
Selecting...
*** ERROR in ttodbc.c, line 141: Unable to close the connection
*** [TimesTen][TimesTen 7.0.5.0.0 ODBC Driver]Function sequence error
*** ODBC Error/Warning = S1010, TimesTen Error/Warning = 0
*** ERROR in ttodbc.c, line 143: Unable to free the connection handle
*** [TimesTen][TimesTen 7.0.5.0.0 ODBC Driver]Function sequence error
*** ODBC Error/Warning = S1010, TimesTen Error/Warning = 0
*** ERROR in ttodbc.c, line 148: Unable to free the environment handle
*** [TimesTen][TimesTen 7.0.5.0.0 ODBC Driver]Function sequence error
*** ODBC Error/Warning = S1010, TimesTen Error/Warning = 0
该程序在LINUX32平台好像能运行,在LINUX64平台上出现问题,请好心人帮忙解决一下,不胜感激