CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15
  1. #1
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    SQL - where to start?

    Hi

    I need to write a program that reads the contains of MSSQL Database and copy the data to a MYSQL database. I have no idea where to start. How do I get access to a mysql and mssql database? Has anybody a good example for me? Is it maybe easier to use C# for this problem? If yes, is there anywhere a good HowTo?

    best regards
    Grit

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: SQL - where to start?

    Well. .. to start somewhere. . make sure you have a Visual Studio .
    It doesn't matter what language you use. You can use C# or MFC or ...
    Most of the databases can be accessed by ODBC. For accessing the data, you usually use SQL. So. . I guess it depends more on what you want to build instead of how.

  3. #3
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: SQL - where to start?

    I have the VC 2005 and I don't want to use ODBC. I downloaded the mysql API but there were no lib files or dll files but only header files. I have no idea how to use them without a lib or dll. I also need some howto for connecting to MS SQL Server. Is there a lib for that too?

    I did write something similar already with PHP but in C++ it's a bit different because I don't know which class or function I need to use for it

    Love
    Grit

  4. #4
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: SQL - where to start?

    You have to use either the native drivers or the odbc drivers. There is no way to do it without them (from any practical sense).
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  5. #5
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: SQL - where to start?

    Where do I get the native driver for MSSQL?

    Grit

  6. #6
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: SQL - where to start?

    With SQLServer or with the .Net Runtime (for managed code only)
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: SQL - where to start?

    SQL Server will let you export data directly. Depending on your requirements, you may not need to write any code at all.

    ODBC would be much, much easier than using any kind of native API.

  8. #8
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: SQL - where to start?

    Do you know where I could find a simple example how to connect to a MS SQL Server?

    Grit

  9. #9
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: SQL - where to start?

    Quote Originally Posted by GCDEF
    SQL Server will let you export data directly. Depending on your requirements, you may not need to write any code at all.

    ODBC would be much, much easier than using any kind of native API.
    Well I have a table in the MSSQL database. Once a day special columns of the table shall be copied to a MySQL database on a Linux Server.

    The orginal base contains a table with FirstName, LastName, birthdate and some other things. Only the entire Firstnames and Lastnames shall be copied to the Linux MySql database each night. I thought it would be as easy as in PHP to connect to both database and do the copying. If there is a way to do that without writing a program I would be happy but I also would like to learn how to do this with a C++ or C# program

    Grit

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: SQL - where to start?

    The easiest way I know programatically would be to use Class Wizard to create CRecordset derived classes for the source and destination databases. From there the code you'd need to write would be trivial. Read up on CRecordset.

    I'm not a SQL admin type person, but that does seem like something you could do directly with SQL Server too.

  11. #11
    Join Date
    Mar 2005
    Location
    Romania,Cluj-Napoca
    Posts
    1,073

    Re: SQL - where to start?

    Have a look at Ovidiu Cucu's article.
    MySQl Wrapp
    Please use code tags [code] [/code]

    We would change the world, but God won't give us the sourcecode..
    Undocumented futures are fun and useful....
    ___
    ______
    Gili

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: SQL - where to start?

    Is this a one-time MSSQL -> MySQL conversion or do you need this operation to run periodically (say once a day)?

  13. #13
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: SQL - where to start?

    Aejay,

    You are slipping....look back at post #9
    Once a day special columns of the table shall be copied to a MySQL database on a Linux Server.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  14. #14
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: SQL - where to start?

    Quote Originally Posted by TheCPUWizard
    Aejay,

    You are slipping....look back at post #9


    Oops, missed that. Anyway, you may want to consider running this as a service or at least provide logging to the event viewer to capture any errors that may occur.

  15. #15
    Join Date
    Jun 1999
    Location
    North Germany
    Posts
    306

    Re: SQL - where to start?

    Quote Originally Posted by g_gili
    Have a look at Ovidiu Cucu's article.
    MySQl Wrapp
    I saw this already but I get alot of errors when I use the VS 2005 for compiling :-(

    I also don't know if this can connect to a MS SQL database too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured