![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 3
Rep Power: 0
![]() |
Using ODBC to connect to a remote database in a C program
Hello all,
My first time posting here. The title is basically exactly what I'm trying to do. I have really no experience at this. I've written code in PHP before that connects to a remote MySQL database and also code in Java Servlets that connects to a remote MySQL database, but not in C. (I imagine connecting to an Oracle database via ODBC is the same idea as connecting to a MySQL database via JDBC, so I won't ask about that part) I also already have a pretty solid understanding of how database systems work and how programs usually connect to one. Basically I've downloaded Microsoft's free Visual C++ Toolkit 2003, and I've also downloaded MDAC (Data Access Component) and Platforms SDK, so I've got sql.h, sqlext.h, sqltypes.h and all that needed functions to send SQL queries and get results back. In fact I've even got a little sample program that shows how to do all of that in the simplest way possible. However I still need to find out how to connect to a remote database. Let's say my database resides in some server 123.45.67.89. sql.h and stuff lets me define a DSN (Data Source Name?) to connect to but not a network address. Could someone walk me through on how to do this? In fact, all I'd really need to know is: 1) what libraries do I need 2) a very small sample program that connects to a remote database, send a query, and get a result. I can figure out everything if I just have these two things. I'm doing this in C, so I would prefer sample code in C. However C++ is fine as well, no problem. Thanks a lot for any help! |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|