Re: Net-Lib protocol driver call to read data failed

Actually, I looked through those messages and didn't find the answer. Here's
description of my problem.
I'm using some home made C-library to work with Sybase DB.  This library
uses Open client lib. My code is written in Java and uses JNI calls to the
C-library. In this home made library I have function to do connect to Sybase
DB.
Here's source code.

JRN_RC JrnInitAPI(litstring username, litstring password)
{
   CS_RETCODE rc;
   int status = -999;
   long SQLCODE = -999;
   SQLCA sqlCA;

   if (username == NULL || password == NULL || *username == 0)
      return JRN_NORIGHTS;

   /* allocate all the crap we need to get Sybase going */
   if (cs_ctx_alloc(OUR_VERSION, &ctxt) != CS_SUCCEED)
   {
      return JRN_DUNNO;
   }

   if (ct_init(ctxt, OUR_VERSION) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   if (ct_con_alloc(ctxt, &plda) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   else if (ct_diag(plda, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) !=
CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if (ct_con_props(db_my_lda(), CS_SET, CS_USERNAME, (void*)username,
CS_NULLTERM, NULL) != CS_SUCCEED ||
       ct_con_props(db_my_lda(), CS_SET, CS_PASSWORD, (void*)password,
CS_NULLTERM, NULL) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if ((rc = ct_connect(db_my_lda(), NULL, 0)) != CS_SUCCEED)
   {
#ifdef _DEBUG
      sprintf(temp, "\n================== ct_connect retcode  %d
================", rc);
      writeDebugInfoToFile(temp);

      status = -999;
      rc = ct_diag (plda, CS_STATUS, CS_ALLMSG_TYPE, CS_UNUSED, &status);
      sprintf(temp, "\n================== ct_diag rc status %d %d
================", rc, status);
      writeDebugInfoToFile(temp);

      rc = ct_diag (plda, CS_GET, SQLCODE_TYPE, 1, &SQLCODE);
      sprintf(temp, "\n================== ct_diag 2 rc  SQLCODE %d %ld
================", rc, SQLCODE);
      writeDebugInfoToFile(temp);

      rc = ct_diag (plda, CS_GET, SQLCA_TYPE, 1, &sqlCA);
      sprintf(temp, "\n================== ct_diag 2 rc  SQLCA %d %s
================", rc, sqlCA.sqlerrm.sqlerrmc);
      writeDebugInfoToFile(temp);

#endif

      ct_con_drop(db_my_lda());
      cs_ctx_drop(ctxt);
#ifdef _DEBUG
      sprintf(temp, "\n================== ct_connect retcode  %d
================", rc);
      writeDebugInfoToFile(temp);
#endif
      return JRN_NORIGHTS;
   }
}

Nothing special, right? When I call this function from my Java code I got
"Net-Lib protocol driver call to read data failed" (see ct_connect()
function). That's not all. The error disappears if I move the call in my
Java code to some different place. For ex., in the very beggining of my main
class. Any ideas? I spent 2 days investigating this problem.


"Anthony Mandic" <sp_am_block@start.com.au> wrote in message
news:3CD35177.F696415C@start.com.au...
> Dmitry wrote:
> >
> > If somebody has any idea what this error means. I'm just calling
> > ct_connect() and get this error.
>
> Search back in this newsgroup to the start of November last
> year and you'll find a post with the same subject with some
> follow ups. See if that helps. If not, post back with more
> information.
>
> -am � 2002


0
Dmitry
5/6/2002 4:16:58 PM
sybase.ase.unix 866 articles. 0 followers. Follow

2 Replies
780 Views

Similar Articles

[PageSpeed] 52

Actually, I looked through those messages and didn't find the answer. Here's
description of my problem.
I'm using some home made C-library to work with Sybase DB.  This library
uses Open client lib. My code is written in Java and uses JNI calls to the
C-library. In this home made library I have function to do connect to Sybase
DB.
Here's source code.

JRN_RC JrnInitAPI(litstring username, litstring password)
{
   CS_RETCODE rc;
   int status = -999;
   long SQLCODE = -999;
   SQLCA sqlCA;

   if (username == NULL || password == NULL || *username == 0)
      return JRN_NORIGHTS;

   /* allocate all the crap we need to get Sybase going */
   if (cs_ctx_alloc(OUR_VERSION, &ctxt) != CS_SUCCEED)
   {
      return JRN_DUNNO;
   }

   if (ct_init(ctxt, OUR_VERSION) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   if (ct_con_alloc(ctxt, &plda) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   else if (ct_diag(plda, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) !=
CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if (ct_con_props(db_my_lda(), CS_SET, CS_USERNAME, (void*)username,
CS_NULLTERM, NULL) != CS_SUCCEED ||
       ct_con_props(db_my_lda(), CS_SET, CS_PASSWORD, (void*)password,
CS_NULLTERM, NULL) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if ((rc = ct_connect(db_my_lda(), NULL, 0)) != CS_SUCCEED)
   {
#ifdef _DEBUG
      sprintf(temp, "\n================== ct_connect retcode  %d
================", rc);
      writeDebugInfoToFile(temp);

      rc = ct_diag (plda, CS_GET, SQLCA_TYPE, 1, &sqlCA);
      sprintf(temp, "\n================== ct_diag 2 rc  SQLCA %d %s
================", rc, sqlCA.sqlerrm.sqlerrmc);
      writeDebugInfoToFile(temp);

#endif
      ct_con_drop(db_my_lda());
      cs_ctx_drop(ctxt);
      return JRN_NORIGHTS;
   }
}

Nothing special, right? When I call this function from my Java code I got
"Net-Lib protocol driver call to read data failed" (see ct_connect()
function). That's not all. The error disappears if I move the call in my
Java code to some different place. For ex., in the very beggining of my main
class. Any ideas? I spent 2 days investigating this problem. I'm not Sybase
expert.


"Anthony Mandic" <sp_am_block@start.com.au> wrote in message
news:3CD35177.F696415C@start.com.au...
> Dmitry wrote:
> >
> > If somebody has any idea what this error means. I'm just calling
> > ct_connect() and get this error.
>
> Search back in this newsgroup to the start of November last
> year and you'll find a post with the same subject with some
> follow ups. See if that helps. If not, post back with more
> information.
>
> -am � 2002


0
Dmitry
5/6/2002 2:05:30 PM
From: "Dmitry" <dmitry.l@mailcity.com>
Subject: Re: Net-Lib protocol driver call to read data failed
Date: Monday, May 06, 2002 10:05 AM

Actually, I looked through those messages and didn't find the answer. Here's
description of my problem.
I'm using some home made C-library to work with Sybase DB.  This library
uses Open client lib. My code is written in Java and uses JNI calls to the
C-library. In this home made library I have function to do connect to Sybase
DB.
Here's source code.

JRN_RC JrnInitAPI(litstring username, litstring password)
{
   CS_RETCODE rc;
   int status = -999;
   long SQLCODE = -999;
   SQLCA sqlCA;

   if (username == NULL || password == NULL || *username == 0)
      return JRN_NORIGHTS;

   /* allocate all the crap we need to get Sybase going */
   if (cs_ctx_alloc(OUR_VERSION, &ctxt) != CS_SUCCEED)
   {
      return JRN_DUNNO;
   }

   if (ct_init(ctxt, OUR_VERSION) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   if (ct_con_alloc(ctxt, &plda) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      return JRN_DUNNO;
   }

   else if (ct_diag(plda, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) !=
CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if (ct_con_props(db_my_lda(), CS_SET, CS_USERNAME, (void*)username,
CS_NULLTERM, NULL) != CS_SUCCEED ||
       ct_con_props(db_my_lda(), CS_SET, CS_PASSWORD, (void*)password,
CS_NULLTERM, NULL) != CS_SUCCEED)
   {
      cs_ctx_drop(ctxt);
      ct_con_drop(db_my_lda());
      return JRN_DUNNO;
   }

   if ((rc = ct_connect(db_my_lda(), NULL, 0)) != CS_SUCCEED)
   {
#ifdef _DEBUG
      sprintf(temp, "\n================== ct_connect retcode  %d
================", rc);
      writeDebugInfoToFile(temp);

      rc = ct_diag (plda, CS_GET, SQLCA_TYPE, 1, &sqlCA);
      sprintf(temp, "\n================== ct_diag 2 rc  SQLCA %d %s
================", rc, sqlCA.sqlerrm.sqlerrmc);
      writeDebugInfoToFile(temp);

#endif
      ct_con_drop(db_my_lda());
      cs_ctx_drop(ctxt);
      return JRN_NORIGHTS;
   }
}

Nothing special, right? When I call this function from my Java code I got
"Net-Lib protocol driver call to read data failed" (see ct_connect()
function). That's not all. The error disappears if I move the call in my
Java code to some different place. For ex., in the very beggining of my main
class. Any ideas? I spent 2 days investigating this problem. I'm not Sybase
expert.


"Anthony Mandic" <sp_am_block@start.com.au> wrote in message
news:3CD35177.F696415C@start.com.au...
> Dmitry wrote:
> >
> > If somebody has any idea what this error means. I'm just calling
> > ct_connect() and get this error.
>
> Search back in this newsgroup to the start of November last
> year and you'll find a post with the same subject with some
> follow ups. See if that helps. If not, post back with more
> information.
>
> -am � 2002




0
Dmitry
5/6/2002 2:22:00 PM
Reply:

Web resources about - Re: Net-Lib protocol driver call to read data failed - sybase.ase.unix

Kyoto Protocol - Wikipedia, the free encyclopedia
... in their carbon dioxide emissions from fuel combustion between 1990 and 2009. For more detailed country/region information, see Kyoto Protocol ...

Jarryd Hayne's return to San Francisco 49ers line-up may hinge on NFL's strict concussion protocol
After suffering a concussion in the disastrous loss to Cleveland, the man standing in Jarryd Hayne's way could find he has no choice but to sit ...

NAB joins global banks to design 'blockchain' protocols
National Australia Bank has joined 20 global global banks in a trial of technologies based on the "blockchain" that facilitates bitcoin transactions. ...

New attacks on Network Time Protocol can defeat HTTPS and create chaos
... or tamper with Bitcoin transactions, computer scientists warned Wednesday. The vulnerabilities reside in the N etwork Time Protocol , the widely ...

NFL Considering Changes to Officiating Protocol for Playoffs - Bleacher Report
With the NFL officials under the microscope more than ever, the league is contemplating making changes to officiating protocol for the postseason... ...

Theme parks add extra safety protocols - Videos - CBS News
Major U.S. theme parks across the country, including Disney, SeaWorld and Universal Studios, are tightening security measures at entry gates. ...


Terrence Jones returns to practice after passing concussion protocol
Rockets forward Terrence Jones returned to practice on Thursday after going through the NBA’s concussion protocol, saying he felt no loss of ...

Ongoing MD5 support endangers cryptographic protocols
... hasn't been used to sign SSL/TLS server certificates in many years, but continues to be used in other parts of encrypted communications protocols, ...

'Routine,' 'standard,' and 'protocol' for police usually means overkill for black folks
A neighbor sees someone who may be breaking into a home. Civic-minded and filled with neighborly concern, the witness dials 911 and asks police ...

Resources last updated: 1/14/2016 3:15:19 AM