Hello All,
I have strange problem with libodbc++ ( 0.2.3 or 0.2.2 ).
i'm using mysql-4.0.14 , MyODBC-3.51.06 and unixODBC-2.2.6
configured with following options
1.MySQL
../configure --prefix=/usr/local/test --with-openssl
--with-mysqld-user=root --enable-thread-safe-client --with-pthread
--enable-shared
2.unixODBC
../configure --prefix=/usr/local/test --sysconfdir=/etc
--enable-threads=yes
3.MyODBC
../configure --prefix=/usr/local/test
--with-mysql-libs=/usr/local/MailQubeBuild/lib/mysql
--with-mysql-includes=/usr/local/MailQubeBuild/include/mysql
--with-unixODBC=/usr/local/MailQubeBuild --enable-thread-safe
4.libodbc
../configure --prefix=/usr/local/test
--with-odbc=/usr/local/MailQubeBuild --enable-threads
OS is a Red Hat 7.3
and problem is that when i'm trying to write to database - all is ok
but when i try to read i get empty resultsets
here is a test code which fails :
void _perform_test()
{
int iCnt = 0;
long lID = 0;
odbc::Statement * stmt = NULL;
odbc::ResultSet * rset = NULL;
std::string csQuery;
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! Testing DB
!!!!!!!!!!!!!!" );
odbc::PreparedS tatement* rs=connDBConnec tion->prepareStateme nt
("create table tmp__ ( testfld int(1))TYPE=INN ODB ;");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
}
rs=connDBConnec tion->prepareStateme nt ("insert into tmp__
values(1)");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
}
csQuery += "SELECT * FROM tmp__";
try {
stmt=connDBConn ection->createStatemen t();
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( stmt ) delete stmt;
}
try {
rset=stmt->executeQuery(c sQuery);
while(rset->next()) {
lID = rset->getLong ( "testfld" );
iCnt++;
}
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) { delete rset; rset = NULL; }
if( stmt ) { delete stmt; stmt = NULL; }
}
rs=connDBConnec tion->prepareStateme nt ("drop table tmp__");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
return 0;
}
if( iCnt != 1 || lID != 1 )
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! ERROR
!!!!!!!!!!!!!!" );
else
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! TEST
PASSED !!!!!!!!!!!!!!" );
}
and problem is that each time i get ERROR :)
so may be someone can help me?
best wishes,
decho
I have strange problem with libodbc++ ( 0.2.3 or 0.2.2 ).
i'm using mysql-4.0.14 , MyODBC-3.51.06 and unixODBC-2.2.6
configured with following options
1.MySQL
../configure --prefix=/usr/local/test --with-openssl
--with-mysqld-user=root --enable-thread-safe-client --with-pthread
--enable-shared
2.unixODBC
../configure --prefix=/usr/local/test --sysconfdir=/etc
--enable-threads=yes
3.MyODBC
../configure --prefix=/usr/local/test
--with-mysql-libs=/usr/local/MailQubeBuild/lib/mysql
--with-mysql-includes=/usr/local/MailQubeBuild/include/mysql
--with-unixODBC=/usr/local/MailQubeBuild --enable-thread-safe
4.libodbc
../configure --prefix=/usr/local/test
--with-odbc=/usr/local/MailQubeBuild --enable-threads
OS is a Red Hat 7.3
and problem is that when i'm trying to write to database - all is ok
but when i try to read i get empty resultsets
here is a test code which fails :
void _perform_test()
{
int iCnt = 0;
long lID = 0;
odbc::Statement * stmt = NULL;
odbc::ResultSet * rset = NULL;
std::string csQuery;
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! Testing DB
!!!!!!!!!!!!!!" );
odbc::PreparedS tatement* rs=connDBConnec tion->prepareStateme nt
("create table tmp__ ( testfld int(1))TYPE=INN ODB ;");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
}
rs=connDBConnec tion->prepareStateme nt ("insert into tmp__
values(1)");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
}
csQuery += "SELECT * FROM tmp__";
try {
stmt=connDBConn ection->createStatemen t();
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( stmt ) delete stmt;
}
try {
rset=stmt->executeQuery(c sQuery);
while(rset->next()) {
lID = rset->getLong ( "testfld" );
iCnt++;
}
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) { delete rset; rset = NULL; }
if( stmt ) { delete stmt; stmt = NULL; }
}
rs=connDBConnec tion->prepareStateme nt ("drop table tmp__");
try {
rs->executeUpdate( );
}
catch (odbc::SQLExcep tion& e ) {
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[12011] Database exception %s",
e.getMessage(). c_str() );
if( rs ) delete rs;
return 0;
}
if( iCnt != 1 || lID != 1 )
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! ERROR
!!!!!!!!!!!!!!" );
else
LogLineToLogSer ver(MQ_LOG_NOTI CE, "[80200] !!!!!!!!!!!!!! TEST
PASSED !!!!!!!!!!!!!!" );
}
and problem is that each time i get ERROR :)
so may be someone can help me?
best wishes,
decho