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')
The temp table name must be less than 13 characters, so
will be the same "#temporal_tab"
You can check the temp tables withs this selects:
SELECT substring(name,1,13) tabla,
convert(int, substring(name,16,5)) spid,
convert(char(8) ,dateadd(second, (convert(int, substring(name,21,10))/300), "19000101"), 8) connection,
WHERE type = "U"
AND name like "#%"