Post by RandallPost by RandallHi All,
I have a c89 program that is calling a DLL that uses SQL/MP. I'm using dlopen/dlsym to get to the methods. On the first call (happens to be BEGIN WORK), I'm getting SQL [-8025] (not SQL compiled) despite the fact that the SQLCOMP of the DLL works without errors. There is no SQLCOMP for the calling program, which has no SQL region.
Anyone have experience with this situation?
Thanks,
Randall
The SQL/MP Programming Manual for COBOL says explicitly that SQL/MP statements are not supported in user libraries, SRLs, or DLLs. I did not find a similar restriction in the manual for C, but I'd be very surprised if the same restriction did not apply for C as well.
I checked the manual for C again, and it does say that the object file specified to the SQLCOMP command must not be a user library or system library, so that is a somewhat similar restriction, just not mentioning SRLs or DLLs. I don't know why they updated the programming manual for COBOL to document the restriction for SRLs and DLLs, but did not make the same update for the programming manual for C. I am pretty sure that this does NOT mean that SQL/MP statements can be used in a DLL -- I am pretty sure that it is just an omission from the manual.
Well, all I can say is "drats". That would be a very nice feature to have. But I can see the loader having issues trying to chase down whether DLLs are registered in the proper catalog.
I don't believe the issue has anything to do with catalogs. If the SQL/MP runtime needs any statically-allocated global memory, that would be a problem for putting SQL/MP code in a user library, and maybe in DLLs, too. I have a dim recollection that SQL/MP does use static global memory for the structures used to pass the host variables for each statement to the SQL runtime, but I might be remembering that wrong.
The other possible challenge is that the runtime has to load the query plans from the SQL region of the object file in which the SQL statements reside. I think finding the name of the object file would be possible, though I'd have to read some manuals to refresh my memory on whether that could be done.
SQL/MX can be used in a DLL, so if you can switch to using SQL/MX in the DLL (SQL/MX can access SQL/MP tables, you know), that might solve your problem.