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.

ODBC DSN Port Configuration


Question:

I am creating a new DSN. I am able to create the DSN but I need to be able to specify the port in the server alias. I have been unable to do this as of yet. Any suggestions?

AddExtender("wwodb34i.dll")
request=4;ADD SYSTEM DSN
driver="SQL Server";case sensitive
;Modify next like with connection specifics
attrs="DSN=sctestadmin|DESCRIPTION=sctestadmin|SERVER=Ind1Sql06";pipe delimited
displayflag=@FALSE
ret=qConfigData(request, driver, attrs, displayflag)
;Displays error if DSN not created
If ret== @FALSE
Message("qConfigData failed", qConfigError())
Exit
EndIf
Exit
I need to know what I can add to automatically configure the port to 1433.

Answer:

To connect to SQL Server running on a remote computer (via an IP address)

Maybe try this:

attrs="DSN=sctestadmin|DESCRIPTION=sctestadmin|SERVER=xxx.xxx.xxx.xxx|Address=xxx.xxx.xxx.xxx,1433|Network=DBMSSOCN|Database=myDatabaseName|Uid=myUsername|Pwd=myPassword";pipe delimited
Where: Reference:
http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForSQLServer

Answer:

Thank you for the suggestions. After doing snapshots of the pc, I was able to track down the registry key that holds this information. Just as FYI, here is what I had to add to my code.
RegSetValue(@REGMACHINE, "Software\Microsoft\MSSQLServer\Client\ConnectTo[%servername%]", "DBMSSOCN,%servername%,1433") 


Article ID:   W16836
File Created: 2007:07:03:14:26:30
Last Updated: 2007:07:03:14:26:30