Connect to a sql database

This is a discussion on Connect to a sql database within the C++ Programming forums, part of the General Programming Boards category; Hello, ive recently started a program for something i need, and for the user who uses it i want to ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    2

    Connect to a sql database

    Hello, ive recently started a program for something i need, and for the user who uses it i want to record data from the program into the database that is on my computer, i was wondering how to connect to a database from any computer to my computer and store the information.
    I am obviously using c++ and i am using the programm Dev-C++ 4.9.9.2.

    I have all the time in the world and interested in everyones comments.

    Thanks,
    Boy67

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Well, you need to use some database interface. Most databases provide a native C API that you can use from C++. There are also multi-DB libraries, which often provide a superior generic interface, but may not be able to access one DB's special functionality.

    An example of a C++ DB library is SOCI. It supports Oracle, PostgreSQL and MySQL, with additional unsupported backends to Firebird, SQLite, and ODBC, which in turn can connect to pretty much any DB out there.

    Of course, the other issue is making the DB on your computer available to the user of the program.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    2
    Thanks, but im still in learning and didnt understand much of that, so if i install the SOCI libary will it give me an example script of how to connect to my database?

    If not, could you possibly make a script for me if its not too much trouble.

    Thanks,
    Boy67

    Edit: and once downloaded Soci, where do i put it in my c++ folder?

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    8
    Quote Originally Posted by Boy67 View Post
    Thanks, but im still in learning and didnt understand much of that, so if i install the SOCI libary will it give me an example script of how to connect to my database?

    If not, could you possibly make a script for me if its not too much trouble.

    Thanks,
    Boy67

    Edit: and once downloaded Soci, where do i put it in my c++ folder?
    They have documentation here:

    http://soci.sourceforge.net/doc/index.html

    I went and looked because I have a future project on the back burner that will probably use MySQL or something similar.

    THANKS to CornedBee for the answer to a question I hadn't asked yet!!!

  5. #5
    Registered User
    Join Date
    May 2006
    Location
    Berkshire, UK
    Posts
    29
    Have you looked at the MySQL libraries?
    Michael S-R

    Fedora F7 x86_64

    www.steinbeck-reeves.co.uk

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 05:30 PM
  2. Using database in C++ with SQL. is it posible???
    By Lauris in forum C++ Programming
    Replies: 4
    Last Post: 04-18-2007, 10:31 AM
  3. Parsing a flat file to a SQl Server database?
    By Michael71 in forum C Programming
    Replies: 0
    Last Post: 01-16-2007, 12:45 PM
  4. Connect to MS SQL DB
    By Kevin_Meziere in forum C Programming
    Replies: 7
    Last Post: 07-13-2006, 03:10 PM
  5. SQL database Interaction
    By (TNT) in forum C++ Programming
    Replies: 1
    Last Post: 07-14-2003, 04:52 AM

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