Problem with DB handles

This is a discussion on Problem with DB handles within the C Programming forums, part of the General Programming Boards category; Hi, I'm using couple of Sybase stored procedure calls from my C program. If I comment any one of the ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    5

    Question Problem with DB handles

    Hi,

    I'm using couple of Sybase stored procedure calls from my C program. If I comment any one of the SP call, the code works fine but if both the calls are made then the code core dumps.

    Will this may be a problem with db handles? I even tried using two different handles for the SP calls. Even then it core dumped.

    Could you please tell me wht might be the problem? and how to solve it ?

    Thanks in advance,
    Pokks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    Does it still core dump if you comment out most of your other code so it just calls these two procedures and very little else?

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    5
    No I cant do that. It a pretty big code (1000 LOCs)..the SP depends on other variables so it can't be done..

    any other idea??

  4. #4
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    Look at the side effects of the Sybase call. Is there a contextual structure that is being changed as a result of the first call that must be reinitialized before the second call? A good place to start looking is at any structure that you pass to the Sybase calls that is shared between the two calls. Also look at any structures returned by the Sybase interface library.

    I don't have enough information to point you at anything specific.
    Insert obnoxious but pithy remark here

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    - Compile the code with debug enabled.
    - Run the program inside the debugger.

    The debugger should catch the segfault, and provide you with a stack backtrace of the function call heirarchy at the point of the fault.

    If malloc or free are in that list (which is a fairly common reason), then check all your usage of malloc and free to make sure you're not overstepping the end of allocated memory, using it after free, freeing twice, freeing what wasn't malloced etc etc.

    You might also try say electric fence (if you have that)
    gcc prog.c -lefence
    And run that in the debugger as well. If you have a malloc overrun problem for example, that should trap the point where it happens (as opposed to the more normal case of noticing somethings wrong later on).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 05:24 PM
  4. Replies: 5
    Last Post: 11-07-2005, 10:34 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21