WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ODBC
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Problem Adding System DSN for SQL Server


Question:

I'm simply trying to add an odbc connection for SQL Server.. always returing 0 (failed) O
S=XP
WB=2003G

;CODE

addExtender("wwodb34i.dll")

request=4
driver="SQL Server"

attrs="DSN=ClientCalls|Description=Client Calls Database|Driver=c:\windows\system32\sqlsrv32.dll|LastUser=sa|Server=smarttest";pipe delimited

displayflag=@TRUE
ret=qConfigData(4,driver, attrs, @TRUE)

If ret==0 then 
Message("","Failed")
test = qConfigError()
message("",test)
else
Message("","Successful")
endif
Any suggestions??

Answer:

Note: qConfigError( ) returns error or status information if qConfigData fails...

Try:

AddExtender("wwodb34i.dll")
request=4
driver="SQL Server"
attrs="DSN=ClientCalls|Description=Client Calls Database|Driver=c:\windows\system32\sqlsrv32.dll|LastUser=sa|Server=smarttest";pipe delimited

ret = qConfigData(request, driver, attrs, 0) ;line will error

if ret==0

 AskItemList("DSN Configuration failed", qConfigError(),@TAB,@UNSORTED,@SINGLE)

 exit

endif

message("qConfigData", "Successfull")

User reply:

..Getting;
"Invalid Keyword Value Pairs"
"Driver's ConfigDSN,ConfigDriver, or ConfigTranslator failed"
I looked on another PC with this ODBC, checked the registry for odbc.ini, and added those keys to the attrs.

Am I missing something else?

Answer:

It doesn't seem to like the attributes your specifying.
attrs="DSN=ClientCalls|Description=Client Calls Database|Driver=c:\windows\system32\sqlsrv32.dll|LastUser=sa|Server=smarttest";pipe delimited

Maybe read:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/Odbc~Extender/Sample~Code+Create~an~SQL~Server~DSN.txt

Here is some code the has worked in the past.

:createDSN
addextender("wwodb34i.dll")
;Create DSN
request=4;ADD SYSTEM DSN
driver="SQL Server";case sensitive
attrs="DSN=SecurityRpt|DESCRIPTION=Security ALRS Reporting|SERVER=Server|Trusted_Connection=Yes";pipe delimited
displayflag=@false
ret=qConfigData(request, driver, attrs, displayflag)
if ret== @false
 message("qConfigData failed", qConfigError())
 exit
endif
return

Article ID:   W15846
File Created: 2017:07:28:13:58:33
Last Updated: 2014:07:18:09:49:32