Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Thumbs down Unanswered: callable statement & stored procedure & temp tables

    With my callablestatement in Java and jconnect I call a ASE 11.9.2-storedprocedure which creates a temp table during its run. The connection comes from a self written connection pool which uses singleton-technique.

    My problem now is, that under not-reproduceable circumstances I encounter a kind of race-condition where the callablestatement gets called twice from different processes, and then, sybase throws an exception, that the temp table allready exists.

    1. Is seems possible, that the "unique" internal temp table-name is not so unique (under some circumstances)!! Bug ? or Feature ?

    How can I work around that problem ?

    How can I make sure that the temp-table-name is unique (internal) ?

    I can't use a timestamp in the tablename, becourse it is not possible to create a temp-table withj a name from a variable (like 'create table @tblname')

  2. #2
    Join Date
    Jan 2003
    Posts
    35
    Are you sure these two "processes" are actually two different spids within Sybase? If they are coming through the same connection, then the server is telling it like it is, the table already exists.

  3. #3
    Join Date
    Jun 2002
    Location
    Argentina
    Posts
    78
    The temp table name must be less than 13 characters, so

    #temporal_table1

    and

    #temporal_table2

    will be the same "#temporal_tab"
    You can check the temp tables withs this selects:

    SELECT substring(name,1,13) tabla,
    substring(name,14,2) nesting,
    convert(int, substring(name,16,5)) spid,
    convert(char(8) ,dateadd(second, (convert(int, substring(name,21,10))/300), "19000101"), 8) connection,
    crdate creation_time,
    loginame
    FROM tempdb..sysobjects
    WHERE type = "U"
    AND name like "#%"


    tabla nesting spid connection creation_time loginame
    ----- ------- ----------- ---------- ------------- --------
    #temporal_tab 00 60 12:07:11 Mar 24 2003 12:10PM NULL


    Bye

    Sebastian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •