This is a discussion on SQL Server ODBC connection - how to get host / port info? within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I have a connection to SQL Server set up via SQLConnect() referencing a System DSN. Is there a programatic ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a connection to SQL Server set up via SQLConnect() referencing a System DSN. Is there a programatic way to obtain the SQL Server machine's host name and port number from the established connection? The documentation for SQLGetInfo and SQLGetConnectAttr doesn't seem to cover these items. Thanks, Charles Durrant. |
| |||
| Hello, Since you can established the connection successfully, the connection string you use include the host name. You can also refer to the following articles: EnumSQLSvr.exe - Enumerate SQL Servers http://www.sqldev.net/misc/EnumSQLSvr.htm ListSQLSvr.exe - Enumerate SQL Servers http://www.sqldev.net/misc/ListSQLSvr.htm Sophie Guo Microsoft Online Partner Support Get Secure! - www.microsoft.com/security ================================================== === When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== === This posting is provided "AS IS" with no warranties, and confers no rights. |
| |||
| Thanks for the reply Sophie - I'll check out those articles. However : "Sophie Guo [MSFT]" <v-sguo@online.microsoft.com> wrote in message news:0jsczEKeFHA.940@TK2MSFTNGXA01.phx.gbl... > Hello, > Since you can established the connection successfully, the connection > string you use include the host name. I'm not using a connection string - I'm using SQLConnect and just giving it the ODBC System DSN name, user and password. I can get the SQL Server instance name from the connection using SQLGetInfo (... SQL_SERVER_NAME ....), but I don't think this is nescesarily the same as the host name of the machine on which the server is running. Regards, Charles Durrant. |
| |||
| Unfortunately both those examples only give very restricted information on the SQL server instances - I need to get the host machine name and SQL Server port number (for passing to a Java application for it to create a JDBC connection). Any other API's I should be looking at ? The Information must be somewhere as the ODBC DSN dialogs show it. Thanks in advance, Charles Durrant. "Sophie Guo [MSFT]" <v-sguo@online.microsoft.com> wrote in message news:0jsczEKeFHA.940@TK2MSFTNGXA01.phx.gbl... > Hello, > > Since you can established the connection successfully, the connection > string you use include the host name. You can also refer to the following > articles: > > EnumSQLSvr.exe - Enumerate SQL Servers > http://www.sqldev.net/misc/EnumSQLSvr.htm > > ListSQLSvr.exe - Enumerate SQL Servers > http://www.sqldev.net/misc/ListSQLSvr.htm > > Sophie Guo > Microsoft Online Partner Support > > Get Secure! - www.microsoft.com/security > > ================================================== === > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== === > This posting is provided "AS IS" with no warranties, and confers no rights. > |
| ||||
| Hello, The odbc informaiton can be get from the following registry key HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI The port of named instance is dynamically determined when connecting. However, you could manually configure it on server. Sophie Guo Microsoft Online Partner Support Get Secure! - www.microsoft.com/security ================================================== === When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== === This posting is provided "AS IS" with no warranties, and confers no rights. |