简体   繁体   中英

how do i find out which dsn driver is being used?

In my c++ code i am trying to find out which dsn driver my SQLDriverConnect is connecting to to obtain the connection string. Unfortunately the connection string only specifies the driver description and not which driver is being used. Is there anyway to actually figure out which driver is being used?

The connection string you pass to SQLDriverConnect must identify a driver to use somehow, either by using DRIVER={xxx}, DSN=yyy, FILEDSN=zzz. If you think about it, if the string passed to SQLDriverConnect did not identify a driver then how would the ODBC driver manager know which ODBC driver to load. All you need to do is look at the connection string passed to SQLDriverConnect and work out which attributes are being passed. If it is driver=xxx then go into the ODBC administrator and select the drivers tab then look down for the driver name. If it is DSN=xxx then look up DSN xxx in your user or system DSNs in the ODBC Administrator to find which driver they use.

Lastly, once connected there are SQLGetInfo calls you can use to retrieve the driver being used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM