Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Mar 8th, 2005, 3:16 PM   #1
bigi
Newbie
 
Join Date: Mar 2005
Posts: 3
Rep Power: 0 bigi is on a distinguished road
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!
bigi is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:26 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC