Hi all,
I have to create a DSN for SQL-Server. Therefor I use the function "SQLConfigDataSource" from "ODBCCP32.DLL". But the problem is that the SQL-Server does not use the Standard-Portnumber 1433. I've tried to make the DSN with "SERVERNAME xxxx" where xxxx is the Portnumber, sometimes it works, but often it does not. When it does not work, then the Checkbox in the ODBC-Configuration-Tool is checked, so the connection is searching for the standard-port. How can I tell the system that it shall NOT use dynamic configuration?
Thanks for help,
Franz
Hi,
if you are using something like this : Creating DSN to SQL Server in the code
you could insert this attribute: Attributes = Attributes & "Address=190.190.200.100,1433" & Chr(0)
cu
tosc
|||Hi!
Sorry, but this doesn't work with me. I've added this line, but then the connection was not TCP/IP but VIA ?!?
I've the following code:
sprintf(attributes, "DSN=WinCCUsr");
iLen = strlen(attributes) + 1;
sprintf(attributes + iLen, "Server=IND-FRANSCHITZ/WINCC"); //Servername
iLen += strlen(attributes + iLen) + 1;
sprintf(attributes + iLen, "Database=%s","WinCCUsr");
iLen += strlen(attributes + iLen) + 1;
sprintf(attributes + iLen, "Description=Userdaten WinCC");
iLen += strlen(attributes + iLen) + 1;
sprintf(attributes + iLen, "Trusted_Connection=yes");
iLen += strlen(attributes + iLen) + 1;
// sprintf(attributes + iLen, "Address=192.168.0.44,1148",iSqlPortNr);
sprintf(attributes + iLen, "Address=192.168.0.44");
iLen += strlen(attributes + iLen) + 1;
attributes[iLen] = '\0';
if(SQLConfigDataSource(0,ODBC_ADD_DSN,"SQL Server", attributes))
{
DSNCreated = TRUE;
printf("DSN Created\r\n");
}
else
{
printf("DSN Create Error\r\n");
AddSysErrorText("DSN Create Error");
}
Without the Address-Line the DSN is created, but with standard-port 1433.
|||Hi,
sprintf(attributes + iLen, "Network=dbmssocn");
sprintf(attributes + iLen, "Address=192.168.0.44,1148");
__
Thanks a lot,
now it works. But do you know, why the entry in the ODBC-configuration-utility now is "others" and not "TCP/IP"?
|||Hi,
I'm not sure, but it might be the network libary config "networt=dbmssocn".
CU
tosc
InsideSQL.de
No comments:
Post a Comment