mySql to Postgres


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: mySql to Postgres

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    119

    mySql to Postgres

    Hello everyone

    I am a recent graduate and have recently joined my job. I have been assigned a task of introducing a layer between the c++ program and its connectivity with database which would translate a query to any given database which in this case is postgres. We are using mysql++ and I have to write the code such that it works with any database tool.

    Could anyone please guide me?

    Thanks

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    I don't have any experience with Postgres, but I do have experience with SQL Server, MS Access, Oracle, MySQL and DB2.

    I can tell you that the SQL syntax for each platform is different. Even the SQL syntax for MS Access vs SQL Server is slightly different and they are made by the same company.

    What is the quiery that has to work on any database platform?

    You could probably get a: SELECT * FROM tablename to work...but I would not necessarily put my faith in anything more complex than that.

    (Anyone with any database experience would know this about SQL syntax. I'm willing to bet, as poor as I am, that the person who gave you this assignment probably doesn't have a real exhustive database background, right?)
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Oct 2010
    Posts
    119
    Hello Hack. Thanks for your reply

    transition of the system from MySQL to postgres, better would be to make the database connection abstract completely, so if a client decides to buy it and connect it to an oracle database, we don't care.

    These are the exact wordings of my manager and I discussed it with my colleague (my manager wasn't interested in discussing it with me and he seldomly comes to office) and this is what my colleague explained to me that I have been asked to create a Data Access Layer between the C++ application and the database it is interacting with. The program currently uses simple queries like

    1) select 'column' from 'some table' where 'something = something AND something = something'
    2) delete 'column' from 'some table' where 'something' = something'
    3) update 'something'

    there are no joins etc anywhere involved in the current application and these are the only three queries used in the application and I have to convert it to postgres at the moment.

    I hope I have explained it well. And one more thing, is there any thing called TSql?

    Thanks again

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    T-SQL = Transact SQL and is used with Microsoft SQL Server and Sybase
    PL/SQL = Programming Language SQL and is used with Oracle

    For more indepth information on each type Google it.

    There are other types just as there are other SQL versions.

    What you describe should work anywhere. A SELECT query is a SELECT query is a SELECT query. As long as you don't get too fancy that type of simplistic SQL should be generic enough to work on pretty much any platform providing the table structure is identical. In other words, the column names would have to remain the same.

    Connection strings differs from one database to another.

    A connection string that is used for SQL Server is not going to work for Oracle. For reference, see http://www.connectionstrings.com/

    Typically when a commerical ventue such as you are talking about takes on a new customer, they will customize the database setup for that customer prior to shipping the product and will use whatever database system the customer has in place.

    When I did commerical development the company I worked for supported SQL Server and Oracle (that was it...if you wanted our product, you needed to be running one of those two - we did initial onsite installations as a part of the package agreement)

    In short, the simple SQL queries you describe could be make generically available, but the connection string will depend on the database itself (to save nothing on individual database drivers).
    Last edited by Hack; 12-09-2010 at 05:40 AM.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Oct 2010
    Posts
    119
    Thanks Hack once again

    I am a novice in databases and I dont know much. Could you please guide me from the beginning as to how should I start carrying out the task? I am working on Linux and coding the application in C++.

  6. #6
    Join Date
    Oct 2010
    Posts
    119
    What is s Simple Data Access Layer using Hibernate? Do you have any idea?

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    A "Data Access Layer" is nothing more than a fancy term for a computer program which allows you to connect to a database, and manipulate the data therein. In other words, the Data Access Layer is your C++ program.

    I never heard of Hibernate, so I googled it. It looks like it is for Java, but you have said you are using C++.

    http://www.roseindia.net/hibernate/index.shtml
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  8. #8
    Join Date
    Oct 2010
    Posts
    119
    I have just found this website but is above my head ;'(

    http://www.theregister.co.uk/2006/11...ase_framework/

  9. #9
    Join Date
    Oct 2010
    Posts
    119
    Here is another website

    http://www.sqlapi.com/

  10. #10
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    How much experience do you have using C++ just by itself?

    How much using C++ with databases?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  11. #11
    Join Date
    Oct 2010
    Posts
    119
    How much experience do you have using C++ just by itself?

    one year so ofcourse not expert level since I am a recent graduate.

    How much using C++ with databases?

    NONE and right now I have to modify the code written by my ex-colleague ;'(

  12. #12
    Join Date
    Oct 2010
    Posts
    119

  13. #13
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Some links for you.

    http://www.tutorialized.com/tutorial...base-Related/1

    http://www.postgresql.org/about/

    http://www.codeguru.com/cpp/data/dat...cle.php/c10629

    We have a C++ forum section, so any specific C++ coding question should posted there.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  14. #14
    Join Date
    Oct 2010
    Posts
    119
    oh Thank you so much Hack for the links and also recommending the C++ forum section . That's so very nice of you

  15. #15
    Join Date
    Oct 2008
    Posts
    142

    nhibernate

    hi there,

    there is nhibernate for dotnet, which has features like hibernate for other frameworks. you need to know about sql to use nhibernate. knowing linq ( which is like oql ) helps as well. you could use nhibernate with managed c++, or simply c#. these two searches have material about nhibernate and sql or linq:

    http://www.google.com/#sclient=psy&h...&pf=p&pdl=3000

    http://www.google.com/#hl=en&expIds=...de53b2ade8e603

    good luck,

    tonci korsano

Similar Threads

  1. help! Search button
    By lewis905 in forum Database
    Replies: 16
    Last Post: 09-16-2008, 05:45 AM
  2. MySql help Request
    By airrazor in forum Database
    Replies: 6
    Last Post: 10-04-2005, 04:00 PM
  3. Date/Time Data Type
    By felix in forum ASP.NET
    Replies: 2
    Last Post: 04-05-2002, 05:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center