Announcement

Collapse
No announcement yet.

[C++] Connecting to mySQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [C++] Connecting to mySQL

    Before you say it, yes, I searched google at least 30 times, and read a good 20 pages of info on this, and this is what I've come up with:
    - C++ is different based on which compiler you use
    - There is a mysql connection library called mysql++ (located here: http://tangentsoft.net/mysql++/)
    - mysql++ doesn't currently work with borland compiler:
    Will it build under Borland C++ Builder?

    There's a current effort to get it working under version 6 that looks likely to produce fruit. Stay tuned.
    So, I'm wondering if mysql++ is just a library to make connecting easier to do? or whether you just CANT connect to a mysql server without it?

    I'm just fooling around in C++, and I was thinking of making a blogging program (for all my friends to update our lan site), but I'm a bit stuck.

    Thanks in advance if anyone can help.
    - Programmer -

  • #2
    Originally posted by d3ad1ysp0rk
    Before you say it, yes, I searched google at least 30 times, and read a good 20 pages of info on this, and this is what I've come up with:
    - C++ is different based on which compiler you use
    - There is a mysql connection library called mysql++ (located here: http://tangentsoft.net/mysql++/)
    - mysql++ doesn't currently work with borland compiler:


    So, I'm wondering if mysql++ is just a library to make connecting easier to do? or whether you just CANT connect to a mysql server without it?

    I'm just fooling around in C++, and I was thinking of making a blogging program (for all my friends to update our lan site), but I'm a bit stuck.

    Thanks in advance if anyone can help.
    From that page you listed, it talks about various versions of GCC 3.x, perhaps you should try GCC instead of Borland's C++ compiler.

    My C++ experience is a few years old, but I would think you could connect to a MySQL server without this library, this library probaby contains functions and calls to make this easier/simpler.
    Aut disce aut discede

    Comment


    • #3
      Originally posted by AlxRogan
      My C++ experience is a few years old, but I would think you could connect to a MySQL server without this library, this library probaby contains functions and calls to make this easier/simpler.
      That's what I think too, but I'm too stupid to figure out what keywords to use to get the information I need on it. heh

      Also, I might try GCC if I can't figure this out soon.
      - Programmer -

      Comment


      • #4
        If you are just making a blogging system (which would be on a website), you may be just easy trying to do it with PHP and MySQL, and then just using an HTML page thats calls the relevant bits, and you just fill in a form in the admin part of a website.

        Im not sure if this is really relevant to what you want to do, but just trying to look at the problem from a different angle.
        Twigman

        Comment


        • #5
          Yes, I've made that type of system many times with php and mysql, but I felt this would be a nice way to learn c++, and even if I wasn't using a blogging system, mysql connectivity is a nice thing to know how to do anyways. Thanks for the suggestion however.
          - Programmer -

          Comment


          • #6
            Young'ns. Pffffft. Not sure why C++ is necessary, but here's an example in C compiled under gcc.

            http://www.synnottsoftware.com/tutorials/mysql.html

            C++ examples:

            http://www.hk8.org/old_web/linux/sql/ch13_01.htm

            http://www.informit.com/articles/article.asp?p=30494

            search terms: gcc c++ mysql connect example
            time: 2 minutes

            Comment


            • #7
              Use libmysqlclient. It provides a C interface, and will work with any compiler on the planet. Write your own lightweight C++ wrapper if you want object orientation... it takes about 5 minutes.
              45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B0
              45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B1
              [ redacted ]

              Comment


              • #8
                actually... most everything you need to know is already documented directly from the horses mouth at the mysql site. ... it's good reading.

                A few tips:

                1) the mysql definition is actually located in <mysql/mysql.h> on my host
                2) don't overlook the ld params when you are linking your objects together... this will cause you a world of annoyance (explained at mysql site and detailed in the first link murakami tossed)
                3) don't forget that static dictionary passwords can be easily picked out of your binary if this is intended as a distributable client
                4) Borland sucks ass
                if it gets me nowhere, I'll go there proud; and I'm gonna go there free.

                Comment


                • #9
                  Originally posted by converge
                  4) Borland sucks ass
                  yep, not sure why they are still in business

                  Comment


                  • #10
                    Ok, I guess choosing a new compiler might be a good idea.

                    Also, I did look at the mysql site, which is where I found out about mysql++ and found out it didn't work with borland.
                    - Programmer -

                    Comment

                    Working...
                    X