Current filter:
                                You should refresh the page.
                                  • It looks like XPO supports the MySql database, but I can't find any information on how to use MySql with XPO.

                                1 Solution

                                Creation Date Importance Sort by

                                XPO 1.7 supports a lot of different database servers. Below is a list of the available XPO adapters and the corresponding provider assemblies they require. The adapter assembly name contains the server name it supports. For example,
                                DevExpress.Xpo.Advantage supports the Advantage database,
                                DevExpress.Xpo.Ase supports Sybase, and so on.

                                DevExpress.Xpo.Advantage - Advantage.Data.Provider 7.10.0
                                DevExpress.Xpo.Asa - iAnywhere.Data.AsaClient 9.0.2
                                DevExpress.Xpo.Ase - Sybase.Data.AseClient 1.1.327
                                DevExpress.Xpo.DB2 - IBM.Data.DB2 8.1.2
                                DevExpress.Xpo.Firebird - FirebirdSql.Data.Firebird 1.7.0.1
                                DevExpress.Xpo.MySql - MySql.Data 1.0.7
                                DevExpress.Xpo.Oracle - System.Data.OracleClient 1.0.5000
                                DevExpress.Xpo.PervasiveSql - Pervasive.Data.SqlClient 2.10.0.15
                                DevExpress.Xpo.PostgreSql - Npgsql 0.7.0
                                DevExpress.Xpo.VistaDB - VistaDB.Provider 2.11.18

                                To make XPO use your database server, you should do the following:
                                1. Add a pair of assemblies which correspond to your server from the list above to your project's References.
                                2. Generate a connection string using the GetConnectionString function of the appropriate ConnectionProvider class from the DevExpress.Xpo.DB namespace.
                                3. Assign the generated connection string to Session.DefaultSession.ConnectionString.
                                4. Use the same string for all XPO Session objects in your project.

                                The XPO connection string differs from a pure database connection string - it includes the database server name to distinguish strings for different databases. Therefore, you should either use our providers' GetConnectionString method to generate a connection string or assign an existing Connection component of your provider (e.g. SqlConnection to work with MS SQL Server) to the Connection property of the DevExpress.Xpo.Session.

                                Let's consider MySql as an example. You should add the DevExpress.Xpo.MySql and MySql.Data assemblies to your project's References. Then you can use the following code to create a connection to your MySql database:

                                 

                                [C#]
                                static void Main() { string conn = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString("DBSERVER", "user", "pwd", "MyApp"); DevExpress.Xpo.Session.DefaultSession.ConnectionString = conn; Application.Run(new MainForm()); }

                                See Also:
                                Database Systems Supported by XPO in XPO documentation
                                Connection string formats of different database servers
                                How to read the database connection from an application configuration file
                                How to use MS SQL Server instead of MS Access as a persistent storage
                                How to create a correct connection string for XPO providers?

                                • Aldo D 04.07.2014

                                  How could I specify a specific port for mysql?

                                  Thanks

                                • Michael (DevExpress Support) 04.07.2014

                                  @Aldo: You can append the port clause to the string returned by the GetConnectionString method, according to MySQL connection strings.