Re: Connection to ODBC without a DSN

From: Tony (tonyng2_at_spacecommand.net)
Date: 08/30/04


Date: Mon, 30 Aug 2004 18:26:13 -0500

Thanks for the info.
I just need a way now to get the connection string used so I can save it for
next time.
Doesn't look like it gives it back to you.

Thanks,
Tony

"Brannon Jones" <brannonjNOSPAM@gmail.com> wrote in message
news:uXeO4urjEHA.3624@TK2MSFTNGP10.phx.gbl...
> To be more specific, you use SQLDriverConnect instead of SQLConnect.
>
> You can even leverage the driver to prompt for the login information.
>
> Here's an example:
>
> SQLCHAR* connectionString = (SQLCHAR*)"driver={SQL
> Server};database=mydatabase";
> SQLDriverConnect(hdbc, hwnd, connectionString, SQL_NTS, NULL, 0, NULL,
> SQL_DRIVER_PROMPT);
>
> SQL_DRIVER_PROMPT will cause the driver to display a dialog prompting the
> user for the server name and uid/pwd information.
>
> As far as ODBC vs. OLEDB is concerned, OLEDB is nice, it is a lot more
> flexible than ODBC, but it's also a lot more difficult to use. If you're
> accessing simple, relational data, just use ODBC. If you're already using
> ODBC, and you dont need some specific feature of OLEDB, just continue to
use
> ODBC.
>
> Brannon
>
> "Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
> news:qp85j0pfp3pj7qgto5tt19arv0cp9ke86d@4ax.com...
> > You can use a dsn-less connection. Code the connection
> > string with the driver/provider you use in whatever syntax
> > is required for the data access api you are using with your
> > application.
> > OLE DB can provide more functionality and is generally
> > faster than ODBC.
> >
> > -Sue
> >
> > On Fri, 27 Aug 2004 16:17:36 -0500, "Tony"
> > <tonyng2@spacecommand.net> wrote:
> >
> > >Nope, not an option, would require a total recode of my database layer.
> > >I'm required to continue using ODBC.
> > >Application is C++/MFC client server application.
> > >
> > >Thanks,
> > >Tony
> > >
> > >P.S. I have heard that OLEDB runs slightly slower due to COM
marshaling.
> > >What makes it a better choice from a C++ perspective?
> > >
> > >"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> > >news:Of119iHjEHA.3608@TK2MSFTNGP09.phx.gbl...
> > >> You can use an OLEDB connection which is better anyway... see
> > >> http://www.aspfaq.com/2126 for samples that work in VB and ASP, and
the
> > >> basic structure should work from any client language that supports
> it...
> > >>
> > >> --
> > >> http://www.aspfaq.com/
> > >> (Reverse address to reply.)
> > >>
> > >>
> > >>
> > >>
> > >> "Tony" <tonyng2@spacecommand.net> wrote in message
> > >> news:eRxayfHjEHA.1344@TK2MSFTNGP11.phx.gbl...
> > >> > Is it possible to connect to an ODBC driver (e.g. SQL Server or
> Oracle)
> > >> > directly without having to create a DSN before hand.
> > >> >
> > >> > This would be great as dumb users can't handle creating a DSN.
> > >> > Would be nice if I could ask them SQL Server or Oracle, server
name,
> > >user
> > >> > name and password only and programmatically connect with that
amount
> of
> > >> > information.
> > >> >
> > >> > Tony
> > >> >
> > >> >
> > >>
> > >>
> > >
> >
>



Relevant Pages

  • ODBC /OLEDB Connection
    ... The codes works fine with OLEDB to connect and run queries but with ODBC it ... What is wrong with the ODBC connection string? ... It creates a system error in the next ...
    (microsoft.public.dotnet.framework.adonet)
  • ODBC & OLEDB
    ... The codes works fine with OLEDB to connect and run queries but with ODBC it ... What is wrong with the ODBC connection string? ... Security Info=False ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to load data in ListBox using one command from ADODB Recor
    ... Simply use an DSN-less connection string as the ODBC Connection String. ... >> Is there something unique about how you use the ADODB recordset? ... >>> I am using ADODB recordset and has SQL server database. ...
    (microsoft.public.access.gettingstarted)
  • Re: ODBC connection strings - "ODBC;" prefix?
    ... As you can see, if there is "ODBC;" in the connection string, ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vc.database)
  • Re: ODBC string in ADO.NET
    ... You are using an Ole DB connection string with the ... ODBC provider classes. ... The .Net Framework Data Provider for ELEDB does not ... ..Net Framework Data Provider for ODBC. ...
    (microsoft.public.dotnet.languages.csharp)