Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Instance name

Status
Not open for further replies.

peakay

Technical User
Apr 4, 2002
2
AU
I've written an API program (in c++) that will run in Windows... and I need to determine the instance name to be able to attach (using sqleatin) to an instance on unix (solaris) server, or even the same PC. As the program is destined for distribution, hard coded instances is not appropriate. I've used SQLDataSources to list the dsn's available but I need to relate the one selected by the user to their respective instance - any ideas?
 
Peakay,

I have never needed this before and it looks as though you are expected to first CONNECT then use the "sqleatin - Attach" to deduce it.

An idea - you may already have generated an ?.SPF type file which is a neat text-based breakdown of your db Client Configs. The file can be created via the EXPORT facility of the Client Configuration Assistant (for later IMPORT) on another system. You could (perhaps) scan that .SPF file to identify the relevant instance.
 
I've already tried your first idea - you need an instance attachment for the sqleatin to return the instance name - it won't do it for a database connection.

The second idea however, is well worth a try - I'll let you know - I've been hedging around cataloging a node and then reading the node directory - but you need to know the hostname etc before this will work - I'm always missing some vital link in the chain between the dsn (database) and respective instance.

Thanks for the suggestions....

PK

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top