kc*****@gmail.com wrote:
I am trying to find a way to determine the DB2 version level through
c++. I only found one way through IBM's website and i would have to
connect to a db first. I will have to check versions on systems that
do not yet have a database. My applications will be used for creating
db's, backing them up, restoring them, and upgrading data.
Does anyone know a way to get this information without a db connection?
I can use either C++ or C#
You can use the sqleatin function to attach to an instance. This function
uses a SQLCA structure to return inforamtion about the attachment operation
to the caller. If the attachment was successful, the "sqlerrp" attribute
of the structure contains the identifier of the version that the instance
in question uses:
Breakpoint 1, main () at a.c:10
10 rc = sqleatin("stolze", "stolze", "********", &ca);
(gdb) n
11 printf("result: %d\n", rc);
(gdb) print ca
$1 = {sqlcaid = "SQLCA ", sqlcabc = 136, sqlcode = 0, sqlerrml = 46,
sqlerrmc = "11208STOLZE STOLZEQDB2/LINUX28928901", ' ' <repeats 24
times>, sqlerrp = "SQL08023", sqlerrd = {0, 0, 0, 0, 0, 0},
sqlwarn = ' ' <repeats 11 times>, sqlstate = "00000"}
(gdb)
Probably there is another way to get the information. Have a look at the
administrative APIs.
--
Knut Stolze
DB2 Information Integration Development
IBM Germany