We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10031
    • 69 Posts
    I have been verifying the different information about how manage my own DAtabase from MODx Forum.

    I found the http://modxcms.com/forums/index.php/topic,14995.0.html

    In this topic, OpenGeek, concluded that the best option would be to use PDO to access external dababases because the new MODx release will use XPDO and dbapi will be deprecated.

    Please, help me with your opinions and suggestions in order to decide use PDO as standalone with MODx...
    Please, do you know some examples can help to understand the integration of standalone PDO with MODx?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Just use it in your code. MODx doesn’t really care what you use in your scripts; you could use raw PHP mysql functions if you wanted to, although that is strongly discouraged, as eventually the whole back-end is going to get ported from its legacy dependence on MySQL to the ability to use different databases. So getting in the habit of using PDO, or even xPDO, would be a good thing for the long term.

      You could use different databases for your custom data (MSSQL, Oracle, Postgresql etc), though.

      The only thing to keep in mind is that PDO/mysql is only available natively when PHP is configured for it; that should be a warning in your documentation, since it’s usually pretty easy to do so if it’s not already done.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22303 MODX Staff
        • 10,725 Posts
        Keep in mind though that in order to use PDO with MODx 0.9.x/1.0.x, you will be creating two connections to the database on each request that gets data via your PDO instance.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I thought the data was external to the MODx database? Wouldn’t that be the case anyway?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: sottwell at Jun 19, 2009, 01:28 AM

            I thought the data was external to the MODx database? Wouldn’t that be the case anyway?
            Yes, if the data is kept in a separate database container, but if you keep it in the same database, you would only need one connection with MODx Revolution. When you start to look at real scalability and optimization, that could be critical for heavy traffic sites, especially in environments where the database server is separate from the web server and making a database connection is more expensive.
              • 10031
              • 69 Posts
              That is the question,

              I have seen information from forum that some people use own tables inside MODx database or one external database to MODx.
              I understand that it depends on the volume of the information. In my case, will be 4 or 5 tables (I am making the design).

              What would be your recommendations about what would be the best option?
              Tables inside MODx database or external database with PDO to MODx database

                • 10031
                • 69 Posts
                Also,
                I have been from download that MODx Revolution only exist as beta release.
                What general problems I would have if I use PDO standalone with MODx 0.9.6.3 while I wait for the MODx Revolution GA?
                  • 10031
                  • 69 Posts
                  I want to give more information about my question....

                  1.- My database will be on the same MySQL server as the MODx database, and I want to use PDO standalone against API:DBAPI
                  2.- The database will have static data information, and E-Commerce.
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: fran2008 at Jun 19, 2009, 09:32 AM

                    I want to give more information about my question....

                    1.- My database will be on the same MySQL server as the MODx database, and I want to use PDO standalone against API:DBAPI
                    2.- The database will have static data information, and E-Commerce.
                    That should be fine; since PDO does not hijack connections from mysql_ functions, you should have no problems using PDO for this. If moving to Revo, since PDO connections do not interfere with each other, you should still have no problems.
                      • 10031
                      • 69 Posts
                      Jason,

                      thank you so much for your information, and I hope that your important project, OpenExpedio (I have been reading about this), keep on growing up.

                      I am a new developer with MODx, and I have great prospects to apply MODx in an new interactive web site for that tourism people of my country and the world can convey and develop community projects.