 |
|
 |
Hi Rohit, The code looks very great. I would like to have this code in HP Unix with Sybase. Please provide help (or makefile) to compile this code in unix and make use of it. I appretiate your help on this.
Thanks in advance.
|
|
|
|
 |
|
 |
It's been long time since I have worked on Sybase openclient library. I don't even have installation anymore. But you should be able to create simple make file and list of the CPP files. Don't add MutexWin as it is specific to Windows. Add LD_LIBRARY_PATH for your openclient library directory or you can link it statically by specifying the path. If I findsome time, I will create a makefile and send you but I don't have setup to test it.
|
|
|
|
 |
|
 |
Thanks for your help. I compiled this code in Unix.
|
|
|
|
 |
|
 |
Hi! Did you get this code working fine on linux? I've got so many errors! I've corrected many but now i get these :
++ -c -o main.o main.cpp
g++ -c -o Context.o Context.cpp
g++ -c -o Command.o Command.cpp
g++ -c -o Connection.o Connection.cpp
g++ -c -o OpenClient++.o OpenClient++.cpp
g++ -c -o Query.o Query.cpp
g++ -c -o Record.o Record.cpp
g++ -c -o RecordSet.o RecordSet.cpp
g++ -m32 -o OpenClientCpp main.o Context.o Command.o Connection.o Context.o OpenClient++.o Query.o Record.o RecordSet.o -locilib -lsqlite3 -lglib-2.0 -lz -lcrypt -rdynamic -L/usr/lib/mysql -lmysqlclient -lsybct -lsybtcl -lsybcs -lsybcomn -lsybintl -lsybunic -Wl,-Bdynamic -ldl -lnsl -lm
Context.o bss+0x0): multiple definition of `Context::m_pContext'
Context.o bss+0x0): first defined here
Context.o bss+0x4): multiple definition of `Context::m_mtxContext'
Context.o bss+0x4): first defined here
Context.o bss+0x20): multiple definition of `Context::m_bThrowException'
Context.o bss+0x20): first defined here
Context.o: In function `Context::GetInstance(long)':
Context.cpp text+0x0): multiple definition of `Context::GetInstance(long)'
Context.o:Context.cpp text+0x0): first defined here
Context.o: In function `Context::Init_(long)':
Context.cpp text+0xa38): multiple definition of `Context::Init_(long)'
Context.o:Context.cpp text+0xa38): first defined here
Context.o: In function `Context::DeleteInstance()':
Context.cpp text+0x1c6): multiple definition of `Context::DeleteInstance()'
Context.o:Context.cpp text+0x1c6): first defined here
Context.o: In function `Context::Release_(long)':
Context.cpp text+0xbca): multiple definition of `Context::Release_(long)'
Context.o:Context.cpp text+0xbca): first defined here
Context.o: In function `Context::SetDebugLevel(long)':
Context.cpp text+0x242): multiple definition of `Context::SetDebugLevel(long)'
Context.o:Context.cpp text+0x242): first defined here
Context.o: In function `Context::SetDebugFile(std::basic_string, std::allocator > const&)':
Context.cpp text+0x354): multiple definition of `Context::SetDebugFile(std::basic_string, std::allocator > const&)'
Context.o:Context.cpp text+0x354): first defined here
Context.o: In function `Context::SetCallbackHandler(Context::LibType, void*, long)':
Context.cpp text+0x482): multiple definition of `Context::SetCallbackHandler(Context::LibType, void*, long)'
Context.o:Context.cpp text+0x482): first defined here
Context.o: In function `Context::Config(Context::LibType, long, long, void*, long, long*)':
Context.cpp text+0x76e): multiple definition of `Context::Config(Context::LibType, long, long, void*, long, long*)'
Context.o:Context.cpp text+0x76e): first defined here
Context.o: In function `Context::GetCSContext()':
Context.cpp text+0xa2e): multiple definition of `Context::GetCSContext()'
Context.o:Context.cpp text+0xa2e): first defined here
collect2: ld returned 1 exit status
gmake: *** [OpenClientCpp] Error 1
cp -p OpenClientCpp /usr/kpaxhome/bin/linux32
cp: cannot stat `OpenClientCpp': No such file or directory
gmake: *** [install] Error 1
Can you help?
|
|
|
|
 |
|
 |
Hi,
Is there a .dll, .exe, or registry entry that I can tap to get the sybase open client version installed?
Thanks,
|
|
|
|
 |
|
 |
If I remember correctly, it was installed as part of Sybase iAnywhere software.
|
|
|
|
 |
|
 |
Rohit,
I would appreciate if you could specify what type of license is applied on this peice of work. Currently it is too generic.
RM.
|
|
|
|
 |
|
 |
It's MPL. You are free to use/modify the code for your personal/business purpose.
|
|
|
|
 |
|
 |
I would like to use this wrapper with a new C++ project that I am working on.
I have Sybase version 6,7,8,9. I don't have this dll in any of these installed Sybase directories.
Will this wrapper work with these older versions?
Is this dll necessary? If yes, where can I get this dll?
Anne Z.
|
|
|
|
 |
|
|
 |
|
 |
http://www.wodeveloper.com/omniLists/webobjects/1999/msg04527.html
|
|
|
|
 |
|
 |
I don't see the answer at this link.
Will this wrapper even work with a Sybase 9 database?
I don't seem to be able to retrieve the dll from the Sybase site.
Is this dll available anywhere else?
|
|
|
|
 |
|
 |
It's been years since I use the Sybase and this wrapper. Frankly, I don't even have anymore setup of sybase to run this wrapper. You might have to post a question to Sybase forum.
|
|
|
|
 |
|
 |
Well, what about using ASE 15 and the OpenClient it is shipped with. All of the dlls there have been renamed! They are libsybct.dll and libsybcs.dll now and so on... Unfortunatelly, the wrapper won't work. Any suggestions?
|
|
|
|
 |
|
 |
On windows platform where Sybase client installed, you can find the libraries missing in the following directory:
C:\sybase12.5\OCS-12_5\lib
C:\sybase12.5\OCS-12_5\dll
Hope this help.
|
|
|
|
 |
|
 |
I am from China.Could you please send a project to me? I am sorry but I can not download this one.
my mail address: freestyle_1218@hotmail.com
|
|
|
|
 |
|
 |
I have just read your article .A very good article !
Now I am trying to encapsulate the ct_lib with c++,but I find a problem :
when two thread try to select the same table ,then the program coredump.
but when two thread select two different tables,the program can run a longger time,but at last will coredump in some hours!!
My operating system is : aix 5.2
I use pthread and sybase 12.5 client, g++ compiler.
Linking these libs: -lct_r -lcs_r -ltcl_r -lcomn_r -lintl_r -lblk_r -lcobct_r -lnsl -lm -lpthread
with option: -D_AIX_PTHREADS_D7 -D_THREAD_SAFE -Dnthread_rs6000=1
Can you tell me Why? Thanks in advance!!
|
|
|
|
 |
|
 |
There is big memory leak in Query.cpp
In those functions:
CS_RETCODE Query::ProcessRowResult()
CS_RETCODE Query::ProcessComputeResult()
dolumndata isn't released propperly below is patch that fixes it
--- Query.cpp 2007-04-18 11:42:40.000000000 +0200
+++ projects/db/src/Query.cpp 2007-04-18 11:21:57.000000000 +0200
@@ -307,6 +307,7 @@
//////////////////////////////////////////////////////////////////////////////
CS_RETCODE Query::ProcessRowResult()
{
+ LOGDBG("ProcessRowResult()");
// CS_RETCODE status = CS_SUCCEED;
int nRows = 0;
int ColumnCount = 0;
@@ -349,6 +350,7 @@
{
m_oRecordSet.SetMessage("Failed to get column description" "for column number:%d", i);
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -369,9 +371,10 @@
m_oRecordSet.SetMessage("Failed to allocate memory for for ColumnData.value");
for(int j = 0; j < i; j++)
{
- columndata[i].FreeValue();
+ columndata[j].FreeValue();
}
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -384,11 +387,13 @@
if(!BindColumn(i, &columndata[i]))
{
m_oRecordSet.SetMessage("Failed to bind the column:%d", i);
+ LOGDBG("Failed to bind the column: %d" ,i);
for(int j = 0; j < i; j++)
{
- columndata[i].FreeValue();
+ columndata[j].FreeValue();
}
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -415,6 +420,12 @@
}
m_oRecordSet.AddRecord(ColumnCount, columndata);
}
+ for(int i = 0; i < ColumnCount; i++)
+ {
+ columndata[i].FreeValue();
+ }
+ free(columndata);
+ columndata = NULL;
m_oRecordSet.SetRowsRead(nRows);
m_oRecordSet.SetMessage("Number of rows affected:%d", nRows);
return queryStatus;
@@ -465,6 +476,7 @@
{
m_oRecordSet.SetMessage("Failed to get column description" "for column number:%d", i);
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -478,6 +490,7 @@
{
m_oRecordSet.SetMessage("Failed to compute info for column:%d", i);
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -495,9 +508,10 @@
m_oRecordSet.SetMessage("Failed to allocate memory for for ColumnData.value");
for(int j = 0; j < i; j++)
{
- columndata[i].FreeValue();
+ columndata[j].FreeValue();
}
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -512,9 +526,10 @@
m_oRecordSet.SetMessage("Failed to bind the column:%d", i);
for(int j = 0; j < i; j++)
{
- columndata[i].FreeValue();
+ columndata[j].FreeValue();
}
free(columndata);
+ columndata = NULL;
if(!CancelCurrent())
{
queryStatus = CS_FAIL;
@@ -541,6 +556,13 @@
}
m_oRecordSet.AddRecord(ColumnCount, columndata);
}
+
+ for(int i = 0; i < ColumnCount; i++)
+ {
+ columndata[i].FreeValue();
+ }
+ free(columndata);
+ columndata = NULL;
m_oRecordSet.SetRowsRead(nRows);
m_oRecordSet.SetMessage("Number of rows affected:%d", nRows);
return queryStatus;
|
|
|
|
 |
|
 |
Thanks for finding out this leak. I will update the source code.
|
|
|
|
 |
|
 |
Hi, have you fixed the problem of mem leak in the attchment project? Until now, i found thar the leak still exists. You can mail me dwh0403@163.com. Thanks.
|
|
|
|
 |
|
 |
Hi Rohit,
First , sory for my english, i am colombian, and not speaking english very well.
I have two question about your wrapper open client for sybase , maybe you know the answer:
1. in sybase , in the wrapper, how i can call a rpc command and how i can manipulate the result's of this call when the result is a set of records "Record set", the wrapper ever response bool answer when i use command.
2. This wrapper i can use for call a SqlServer 2000, you know anything o any sample for open client with SqlServer using Db Library, Ct Library.
Thank's in advance
Jose Vasquez
mailto:vasjos@gmail.com
Thank's in advance
Jose Vasquez
mailto:vasjos@gmail.com
|
|
|
|
 |
|
 |
Can you add some method like :
Connection::Set_Connection()
With this We can use the code following :
Connection oConn;
...
oConn.Set_Connection(pDbName, pUserName, pPassword, pServerName);
And this for all of your classes (Query, Recordset, Record)
If it's not possible have you a sample tou use your code with global vars ? I'd like to instanciate the recordset in funcationA and use the results in the functionB.
Thanks.
Emmanuel
|
|
|
|
 |
|
 |
Hi
Is there anything like your C++ wrapper written in C#? Do you have one or have you seen any somewhere?
I'm using OpenClient 12 and need to write C# apps that work with my Sybase DBs.
Thank you.
|
|
|
|
 |
|
 |
I am not aware of this. But it would be difficult to implement in C# as Sybase don't provide the library which means we need to implement TDS protocol which sybase C library implements to communicate with Server.
You can search for .NET implementation for TDS protocol.
|
|
|
|
 |
|
 |
It seems to me that the Connections aren't threadsafe, and only one thread should use a Connection at a time. Is that right?
But the code looks very useable; nice work.
|
|
|
|
 |