• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

SQL Server Direct Access

Right now, I'm using CDatabase & CRecordset for ODBC programming. But that's require that ODBC DSN must be set.

Is there anyway that we can directly retrieve recordset from the SQL server without setting the DSN?

  • 2
1 Solution
If you want to use ODBC, then you HAVE to use DSN. The access the MS SQL Server, the only simple way is use ODBC (Also you can use ADO, RDO, or JDBC::ODBC. But they all established upon ODBC)
Yes, there is really another way to access the SQL Server. Directly call it through it's TCP/IP or namepipe protocol.
There's no open document for this. You need to try it yourself.
I do not know why you can not use DSN?

ymw1Author Commented:
Becos I have hundreds of client PCs! And I have to use MFC C++ :(

And the client applications need to connect to the SQL server.....

This means to you installing DSN on every client?
Hundreds of client connect to your MS SQL Server? Oh. M$ software's lisence is expensive. If you have hunderds of clients connect to your SQL Server, that may need  hundreds of client lisence. :-)

Why no use RPC or CORBA or DCOM. You client just connect to your server. Then you only need to establish SQL connection on your Server. Your client can be any OS platform, even Unix. Then you will not have the headache of install DSN on every client.
Also, ODBC SDK has the ability to create DSN on the fly. Please check the "SQLConfigDataSource" function.
But even if you can create DSN on the fly, you still need to install ODBC driver on every of your clients. Tons of work, right.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now