problem connecting to db using odbc

This is a discussion on problem connecting to db using odbc within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm trying to learn how to program for database interaction, I'm using odbc, I've tried multiple ways, and I ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    164

    Unhappy problem connecting to db using odbc

    Hi, I'm trying to learn how to program for database interaction, I'm using odbc, I've tried multiple ways, and I actually can connect to my db but I am getting a pop up box to connect instead of my program directly connecting. I think my problem is in the db.open statment, but I don't completely understand all the perameters that the statment uses. here is the statement I using :

    db.Open("ODBC; DSN=MYDB;");

    can anyone help explain what db.Open needs to correctly call and open the db. I've been searching google, codeproject and cboard trying to find some examples or explanations but I am still confused on the examples. I'm pretty sure my db is registered correctly in for odbc calls. I used the trace option in the data source manager in control panels to find out why it was not connecting properly and I noticed a re-occurring error while attempting to connect about missing driver for db open.

    Any help would be greatly appreciated. Thanks-

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,660

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    164
    Cool, Thanks Codeplug, I will review the link, thanks for the quick response.

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    164

    still scratching my on ODBC connect

    Well, the article makes good sense and definately gives me a better understanding of data source names and how they are used, but when I clicked on the msdn links, I still can't find a good article that depicts the connection process and the necessary attributes for a successful call.

    Unfortunately, I'm still green on the C++ side, so if I can't see how the writer is using the code with a reference to the program, its hard for me to understand what the proper syntax should be.

    Sorry for the lacking knowledge. I'm really hoping I can find a way to use a string to that lists all the necessary protocols for the .Open command. I just don't know what to feed the string in order for it to work properly.

    Thanks in advance for any help?

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    164
    Hey, I finally got it, I was not accessing my dsn correctly in the string I created. Thanks again codeplug, your response pointed me to learning the dsn info I needed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 09:33 AM
  2. Problem connecting to MySQL Database?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 01-30-2006, 10:30 AM
  3. Problem with DB handles
    By pokks in forum C Programming
    Replies: 4
    Last Post: 01-04-2006, 11:06 AM
  4. Replies: 5
    Last Post: 11-07-2005, 10:34 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21