Unix Technical Forum

Retrieving ODBC Settings.

This is a discussion on Retrieving ODBC Settings. within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> I'm having some issues grabbing ODBC Settings. First off I need to present a user with the options to ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:53 PM
=?Utf-8?B?QmlsbHIxNw==?=
 
Posts: n/a
Default Retrieving ODBC Settings.

I'm having some issues grabbing ODBC Settings. First off I need to
present a user with the options to select thier DSN, Server, UID, PWD, and
Database settings. I have come up with a way using the SQLBrowseConnect
function to obtain the Server and Database information I need. Therefore, I
have a semi working version of the program.

I just need a way to make the program a little more user
friendly/fool-proof. I know that there is an option in the ODBC settings to
set an default database. I need a way of retrieving this setting and the
default server as well. Lastly I would like to turn a text box I am currently
using for the DSN name into a dropdown box that contains a list of all
available DSNs. What functions are available to help me poll this list? I'm
really just interested in those DSN's listed under System DSNs in the Data
Source (ODBC).

See the below article for the example I used to model my program thrus far:
http://msdn.microsoft.com/library/de...datasource.asp

Let me know if I was not clear in my explains. Any help would be appreciated.

Bill

P.S. I'm cross posted this because I'm not exactly sure where it belongs.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:53 PM
Sue Hoegemeier
 
Posts: n/a
Default Re: Retrieving ODBC Settings.

You can retrieve the specific settings for a DSN as well as
the existing DNSs by reading the registry - that's where
they are all stored. Check the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

-Sue

On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
<Billr17@discussions.microsoft.com> wrote:

> I'm having some issues grabbing ODBC Settings. First off I need to
>present a user with the options to select thier DSN, Server, UID, PWD, and
>Database settings. I have come up with a way using the SQLBrowseConnect
>function to obtain the Server and Database information I need. Therefore, I
>have a semi working version of the program.
>
> I just need a way to make the program a little more user
>friendly/fool-proof. I know that there is an option in the ODBC settings to
>set an default database. I need a way of retrieving this setting and the
>default server as well. Lastly I would like to turn a text box I am currently
>using for the DSN name into a dropdown box that contains a list of all
>available DSNs. What functions are available to help me poll this list? I'm
>really just interested in those DSN's listed under System DSNs in the Data
>Source (ODBC).
>
>See the below article for the example I used to model my program thrus far:
>http://msdn.microsoft.com/library/de...datasource.asp
>
>Let me know if I was not clear in my explains. Any help would be appreciated.
>
>Bill
>
>P.S. I'm cross posted this because I'm not exactly sure where it belongs.
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 08:53 PM
=?Utf-8?B?QmlsbHIxNw==?=
 
Posts: n/a
Default Re: Retrieving ODBC Settings.

Thank you Sue. This looks like what I was searching for.

Bill

"Sue Hoegemeier" wrote:

> You can retrieve the specific settings for a DSN as well as
> the existing DNSs by reading the registry - that's where
> they are all stored. Check the following key:
> HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
>
> -Sue
>
> On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
> <Billr17@discussions.microsoft.com> wrote:
>
> > I'm having some issues grabbing ODBC Settings. First off I need to
> >present a user with the options to select thier DSN, Server, UID, PWD, and
> >Database settings. I have come up with a way using the SQLBrowseConnect
> >function to obtain the Server and Database information I need. Therefore, I
> >have a semi working version of the program.
> >
> > I just need a way to make the program a little more user
> >friendly/fool-proof. I know that there is an option in the ODBC settings to
> >set an default database. I need a way of retrieving this setting and the
> >default server as well. Lastly I would like to turn a text box I am currently
> >using for the DSN name into a dropdown box that contains a list of all
> >available DSNs. What functions are available to help me poll this list? I'm
> >really just interested in those DSN's listed under System DSNs in the Data
> >Source (ODBC).
> >
> >See the below article for the example I used to model my program thrus far:
> >http://msdn.microsoft.com/library/de...datasource.asp
> >
> >Let me know if I was not clear in my explains. Any help would be appreciated.
> >
> >Bill
> >
> >P.S. I'm cross posted this because I'm not exactly sure where it belongs.
> >

>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 08:54 PM
Igor Shekalev
 
Posts: n/a
Default Re: Retrieving ODBC Settings.

Bill,

Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.

B> a text box I am currently using for the DSN name into a dropdown box
B> that contains a list of all available DSNs. What functions are
B> available to help me poll this list? I'm really just interested in

Igor Shekalev, www.sqledit.com - powerful database tools


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-27-2008, 08:54 PM
=?Utf-8?B?QmlsbHIxNw==?=
 
Posts: n/a
Default Re: Retrieving ODBC Settings.

Thank you for the info, that should easily get me what I need for the
dropdown box. Sues post with the registry key allowed me to retrieve the
default settings and set each controls default value appropriately. I was
going to write some code to pull the DSN's from the registry to, but I think
'SQLDataSources' might be safer. :-)

Bill

"Igor Shekalev" wrote:

> Bill,
>
> Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.
>
> B> a text box I am currently using for the DSN name into a dropdown box
> B> that contains a list of all available DSNs. What functions are
> B> available to help me poll this list? I'm really just interested in
>
> Igor Shekalev, www.sqledit.com - powerful database tools
>
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-27-2008, 08:54 PM
Igor Shekalev
 
Posts: n/a
Default Re: Retrieving ODBC Settings.

Billr,

You are right , it is really safer. As far I know, 2003 server uses registry
entries for DSN a little differently (may be uses ODBC.INI subkey for some
other cases).

B> Thank you for the info, that should easily get me what I need for the
B> dropdown box. Sues post with the registry key allowed me to retrieve
B> the default settings and set each controls default value
B> appropriately. I was going to write some code to pull the DSN's from
B> the registry to, but I think 'SQLDataSources' might be safer. :-)

B> Bill

Igor Shekalev, www.sqledit.com - powerful database tools


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:20 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com