dbTalk Databases Forums  

ct_connect(): user api layer

comp.databases.sybase comp.databases.sybase


Discuss ct_connect(): user api layer in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Prashant
 
Posts: n/a

Default ct_connect(): user api layer - 02-19-2004 , 03:05 AM






Hi,

My application is an Open Server Application connecting to Sybase 12.5
database.
The version of open server & client libraries are
OPENSVR_REL=12.5_32bit_10072 & OPENCLIENT_REL=12.5_32bit_10657.

We are using RW SourcePro 4.0 on Solaris 8.0 with Sun Forte Rel 6.2.

During the application start up it is able to connect to Sybase
database.
The statement to get the database connection is as follows:

RWDBManager::setErrorHandler (errorHandler);
cerr << "Before RWDBManager::database" << endl;
const char * database_access_method = "libctl5215d.so";
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
cerr << "After RWDBManager::database" << endl;
if (dBase.isValid ())
{
cerr << "Connected to DB!" << endl; //on output this mesg. is
displayed.
}
else
{
dBase.setErrorHandler(errorHandler);
cerr << "Set error handler" << endl;
}

The same connection is then used for further database queries in
another file. It is at this time the following error pops up:
[VENDORLIB] Vendor Library Error: ct_connect(): user api layer:
internal common library error: There is an internal error in the user
api layer.
Error number: 17040941
Severity: 6
ZZZZZ

The statement where it is giving error is mentioned below.It is the
first statement in the application that is trying to hit database
after
getting the connection during application start up.

//db is connection at app start up
if (!get_rate_schedule_sp.isValid ())
{
RWCString spname = "dbo.GetRateSchedule_sp";
get_rate_schedule_sp = db.storedProc (spname);
}

Please provide your insight about the probable cause of errors.
Please also tell me what are the configuration settings that I should
look for it.

Thanks.
Prashant

Reply With Quote
  #2  
Old   
Sybaseneal
 
Posts: n/a

Default Re: ct_connect(): user api layer - 02-19-2004 , 08:33 AM






Hello,

It is hard to say what the problem is because you
don't show any of the CT-Library or Open Server
specific code that sets up the connection or that
leads up to the error. (I am not that familiar
with RogueWave so maybe you don't have access to
that layer).

Searching the Sybase call database, I found a few
cases that reported the same error as you report
below. The result was that the customer had not
used all of the APIs required to set up a connection.

The only other thing that comes to mind is how your
are building your application. If it is a threaded
application, you must link with the Sybase threadsafe
libraries (for example, libct_r.so and/or libsrv_r.so).

Thanks,
Neal


Prashant wrote:
Quote:
Hi,

My application is an Open Server Application connecting to Sybase 12.5
database.
The version of open server & client libraries are
OPENSVR_REL=12.5_32bit_10072 & OPENCLIENT_REL=12.5_32bit_10657.

We are using RW SourcePro 4.0 on Solaris 8.0 with Sun Forte Rel 6.2.

During the application start up it is able to connect to Sybase
database.
The statement to get the database connection is as follows:

RWDBManager::setErrorHandler (errorHandler);
cerr << "Before RWDBManager::database" << endl;
const char * database_access_method = "libctl5215d.so";
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
cerr << "After RWDBManager::database" << endl;
if (dBase.isValid ())
{
cerr << "Connected to DB!" << endl; //on output this mesg. is
displayed.
}
else
{
dBase.setErrorHandler(errorHandler);
cerr << "Set error handler" << endl;
}

The same connection is then used for further database queries in
another file. It is at this time the following error pops up:
[VENDORLIB] Vendor Library Error: ct_connect(): user api layer:
internal common library error: There is an internal error in the user
api layer.
Error number: 17040941
Severity: 6
ZZZZZ

The statement where it is giving error is mentioned below.It is the
first statement in the application that is trying to hit database
after
getting the connection during application start up.

//db is connection at app start up
if (!get_rate_schedule_sp.isValid ())
{
RWCString spname = "dbo.GetRateSchedule_sp";
get_rate_schedule_sp = db.storedProc (spname);
}

Please provide your insight about the probable cause of errors.
Please also tell me what are the configuration settings that I should
look for it.

Thanks.
Prashant


Reply With Quote
  #3  
Old   
Prashant
 
Posts: n/a

Default Re: ct_connect(): user api layer - 02-19-2004 , 11:33 PM



Hi,

Thanks for your response.
I tried some more things with the application to find the place where
trying to connect to Sybase 12.5 database fails.

The main() function where it is happening is listed for your
reference.
I have to use a wrapper library that conatins the functionality for
open server.

//code listing BEGIN

#include <ctOSUtils.h>
#include <ctOSConfigurableOpenServer.h>
#include <rw/db/dbase.h>
#include <rw/db/dbmgr.h>
#include <rw/db/stored.h>
#include <unistd.h>

// functions local to this file
#define SRV__SPRINTF sprintf

const char * database_access_method = "libctl5215d.so";

int getargs(int argc, char **argv);
RWBoolean get_db_login ();
RWDBDatabase dBase;

// Global data
RWCString direct_server = "";
RWCString direct_db = "";
RWCString direct_user = "";
RWCString direct_password = "";
RWDBConnection ai_connection ;
RWDBMemTable mt_ai_format ;
RWDBMemTable mt_curr_xref ;
RWDBMemTable mt_day_types ;
RWCString process_date;
char li_flag; // Holds the character used by CcDtconvert to
// determine which ccholly files to use

char Msg [1024];

OSConfigurableOpenServer *os = NULL;
void start_handler(OSConfigurableOpenServer *);
void init(OSConfigurableOpenServer *);
//
// The main program section
//

main (int argc, char **argv)
{
// Debug hook
if(getenv("CSDEBUG"))
{
cout << "\n---- Waiting for debugger to be attached." << endl;
sleep(60);
}

// Read any command line arguments.
getargs(argc, argv);


/*
Till this point able to connect to database again
*/

os = new OSConfigurableOpenServer(argc, argv, init,
start_handler);

/*
At this point also NOT able to connect to database again
*/

os->run ();

exit(STDEXIT);
}

//
// start_handler()
//
// This is the SRV_START event handler. It registers the
// procedures that this Open Server can process.
//

void start_handler(OSConfigurableOpenServer *s)
{
SRV_PROC *srvproc;
int ret;
SRV_SERVER *server;

/*
From this point not able to connect to database, so if I write the
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
it gives the Vendor Library Error: ct_connect(): user api layer:
internal common library error
*/

server = s->get_srvserver();

//
// Create a temporary service process to use in registering the
// procedures.
//

if ((srvproc = srv_createproc(server)) == (SRV_PROC *)NULL )
{
cerr << "Failed to create service process.\n" ;
exit(1);
}

//CODE TO ADD VARIOUS BUSINESS FUNCTIONS CALLBACK

//
// Don't need the service SRV_PROC anymore, so drop it.
//

srv_dropproc (srvproc);

return; // (SRV_CONTINUE);
}

RWBoolean
get_db_login ()
{

//code for getting the username, password etc.

direct_server = (const char*) getenv("DSQUERY");
direct_db = (const char*) getenv("CS_DB");
direct_user = (const char*) getenv("CS_DB_LOGIN");
direct_password = (const char*) getenv("CS_DB_PASSWD");

RWDBManager::setErrorHandler (errorHandler);
cerr << "Before RWDBManager::database" << endl;
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
if (dBase.isValid ()){
cerr << "CONNECTED TO DB!" << endl;
} else {
dBase.setErrorHandler(errorHandler);
cerr << "Set error handler" << endl;
}
ai_connection = dBase.connection();

return dBase.isValid ();

}

//code listing END

The application is using thread safe libraries.
The application is working fine on Solaris 6/Sybase 11.9/Open Client
11.1 and gives this error when migrated to Solaris 8/Sybase 12.5/Open
Client 12.5
I tried connecting the application to old sybase version(11.9) but
still it gives the same error.

Any insight provided by you will be very helpful.

Thanks.
Prashant

Reply With Quote
  #4  
Old   
Sybaseneal
 
Posts: n/a

Default Re: ct_connect(): user api layer - 02-20-2004 , 08:24 AM



Hello,

Can you compile and run the Sybase multthrd sample program
to make sure there is nothing wrong in your environment?

Also, compare the compile/link options used with the multthrd
sample to yours to make sure you are using all of the recommended
Sybase options.

cd $SYBASE/$SYBASE_OCS/sample/ctlibrary
setenv SYBPLATFORM nthread_sun_svr4
make multthrd
setenv DSQUERY your_ASE_here
../multthrd

If that works OK, and your compile/link options are the
same, check with RogueWave. You may be using an
incompatible set of their libraries.

Prashant wrote:
Quote:
Hi,

Thanks for your response.
I tried some more things with the application to find the place where
trying to connect to Sybase 12.5 database fails.

The main() function where it is happening is listed for your
reference.
I have to use a wrapper library that conatins the functionality for
open server.

//code listing BEGIN

#include <ctOSUtils.h
#include <ctOSConfigurableOpenServer.h
#include <rw/db/dbase.h
#include <rw/db/dbmgr.h
#include <rw/db/stored.h
#include <unistd.h

// functions local to this file
#define SRV__SPRINTF sprintf

const char * database_access_method = "libctl5215d.so";

int getargs(int argc, char **argv);
RWBoolean get_db_login ();
RWDBDatabase dBase;

// Global data
RWCString direct_server = "";
RWCString direct_db = "";
RWCString direct_user = "";
RWCString direct_password = "";
RWDBConnection ai_connection ;
RWDBMemTable mt_ai_format ;
RWDBMemTable mt_curr_xref ;
RWDBMemTable mt_day_types ;
RWCString process_date;
char li_flag; // Holds the character used by CcDtconvert to
// determine which ccholly files to use

char Msg [1024];

OSConfigurableOpenServer *os = NULL;
void start_handler(OSConfigurableOpenServer *);
void init(OSConfigurableOpenServer *);
//
// The main program section
//

main (int argc, char **argv)
{
// Debug hook
if(getenv("CSDEBUG"))
{
cout << "\n---- Waiting for debugger to be attached." << endl;
sleep(60);
}

// Read any command line arguments.
getargs(argc, argv);


/*
Till this point able to connect to database again
*/

os = new OSConfigurableOpenServer(argc, argv, init,
start_handler);

/*
At this point also NOT able to connect to database again
*/

os->run ();

exit(STDEXIT);
}

//
// start_handler()
//
// This is the SRV_START event handler. It registers the
// procedures that this Open Server can process.
//

void start_handler(OSConfigurableOpenServer *s)
{
SRV_PROC *srvproc;
int ret;
SRV_SERVER *server;

/*
From this point not able to connect to database, so if I write the
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
it gives the Vendor Library Error: ct_connect(): user api layer:
internal common library error
*/

server = s->get_srvserver();

//
// Create a temporary service process to use in registering the
// procedures.
//

if ((srvproc = srv_createproc(server)) == (SRV_PROC *)NULL )
{
cerr << "Failed to create service process.\n" ;
exit(1);
}

//CODE TO ADD VARIOUS BUSINESS FUNCTIONS CALLBACK

//
// Don't need the service SRV_PROC anymore, so drop it.
//

srv_dropproc (srvproc);

return; // (SRV_CONTINUE);
}

RWBoolean
get_db_login ()
{

//code for getting the username, password etc.

direct_server = (const char*) getenv("DSQUERY");
direct_db = (const char*) getenv("CS_DB");
direct_user = (const char*) getenv("CS_DB_LOGIN");
direct_password = (const char*) getenv("CS_DB_PASSWD");

RWDBManager::setErrorHandler (errorHandler);
cerr << "Before RWDBManager::database" << endl;
dBase = RWDBManager::database (database_access_method,
direct_server, direct_user, direct_password, direct_db);
if (dBase.isValid ()){
cerr << "CONNECTED TO DB!" << endl;
} else {
dBase.setErrorHandler(errorHandler);
cerr << "Set error handler" << endl;
}
ai_connection = dBase.connection();

return dBase.isValid ();

}

//code listing END

The application is using thread safe libraries.
The application is working fine on Solaris 6/Sybase 11.9/Open Client
11.1 and gives this error when migrated to Solaris 8/Sybase 12.5/Open
Client 12.5
I tried connecting the application to old sybase version(11.9) but
still it gives the same error.

Any insight provided by you will be very helpful.

Thanks.
Prashant


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.