Hi there. I'd like to connect OpenCart to an existing MS SQL Server database. This is a brand new installation of OpenCart. The SQL Server PDO Connection Driver found here https://www.opencart.com/index.php?rout ... load_id=10 seemed like a possible solution, but I’m struggling with how to get this DB Driver to appear in the drop-down list available for selection during OpenCart installation. Does a properly modified version of the following code (provided with that driver) need to go somewhere prior to running my installation? I had thought that it might go in the config.php file, but now I see that file is empty (presumably it gets built during the installation procedure).
// DB
define('DB_DRIVER', 'sqlPDO');
define('DB_HOSTNAME', '127.0.0.1');
define('DB_USERNAME', 'Your_username');
define('DB_PASSWORD', 'Your_password');
define('DB_DATABASE', 'Databasename');
define('DB_PORT', '1433');
define('DB_PREFIX', 'oc_');
Please also direct me elsewhere if appropriate as the driver that I mention above might not be the way to go? I only want to connect to an existing MS SQL Server database... however that can best be accomplished! And please forgive my ignorance.
I thought that perhaps adding those definitions for "install\index.php" would have done the trick, but no go. I'm a bit stymied on this.
Many thanks to anyone that can point me in the right direction to connect a brand new OpenCart installation to an MS SQL Server database.
Thanks!
// DB
define('DB_DRIVER', 'sqlPDO');
define('DB_HOSTNAME', '127.0.0.1');
define('DB_USERNAME', 'Your_username');
define('DB_PASSWORD', 'Your_password');
define('DB_DATABASE', 'Databasename');
define('DB_PORT', '1433');
define('DB_PREFIX', 'oc_');
Please also direct me elsewhere if appropriate as the driver that I mention above might not be the way to go? I only want to connect to an existing MS SQL Server database... however that can best be accomplished! And please forgive my ignorance.
I thought that perhaps adding those definitions for "install\index.php" would have done the trick, but no go. I'm a bit stymied on this.
Many thanks to anyone that can point me in the right direction to connect a brand new OpenCart installation to an MS SQL Server database.
Thanks!
OC version. Complete the installation with mySQLi and use the extension afterwards to load the admin and store to see if that will solve the issue. If not, contact the extension developer to resolve this issue.dbonikowsky wrote: ↑Sat Feb 24, 2024 5:27 amHi there. I'd like to connect OpenCart to an existing MS SQL Server database. This is a brand new installation of OpenCart. The SQL Server PDO Connection Driver found here https://www.opencart.com/index.php?rout ... load_id=10 seemed like a possible solution, but I’m struggling with how to get this DB Driver to appear in the drop-down list available for selection during OpenCart installation. Does a properly modified version of the following code (provided with that driver) need to go somewhere prior to running my installation? I had thought that it might go in the config.php file, but now I see that file is empty (presumably it gets built during the installation procedure).
// DB
define('DB_DRIVER', 'sqlPDO');
define('DB_HOSTNAME', '127.0.0.1');
define('DB_USERNAME', 'Your_username');
define('DB_PASSWORD', 'Your_password');
define('DB_DATABASE', 'Databasename');
define('DB_PORT', '1433');
define('DB_PREFIX', 'oc_');
Please also direct me elsewhere if appropriate as the driver that I mention above might not be the way to go? I only want to connect to an existing MS SQL Server database... however that can best be accomplished! And please forgive my ignorance.
I thought that perhaps adding those definitions for "install\index.php" would have done the trick, but no go. I'm a bit stymied on this.
Many thanks to anyone that can point me in the right direction to connect a brand new OpenCart installation to an MS SQL Server database.
Thanks!
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
You would need to modify install/controller/install/step_2.php get it to show at isntall.
Thanks a lot for your replies. Please, please forgive my ignorance... I beg you 
@straighlight - would I be wrong in assuming that the OpenCart installation would, in part, create the database structure (tables, etc.) as part of its process? If so, wouldn't I need to actually run the installation specifying MS SQL Server as my backend database?
@ADD Creative - when you suggest modifying the file "install/controller/install/step_2.php" to get the mssql driver to show at install, are you saying that's where this properly altered code would go?
// DB
define('DB_DRIVER', 'sqlPDO');
define('DB_HOSTNAME', '127.0.0.1');
define('DB_USERNAME', 'Your_username');
define('DB_PASSWORD', 'Your_password');
define('DB_DATABASE', 'Databasename');
define('DB_PORT', '1433');
define('DB_PREFIX', 'oc_');
Is this at all ill-advised... to try to connect OpenCart to MS SQL Server? I know that it may not be the norm, as open source and MS SQL Server don't really go hand in hand, but with the popularity of OpenCart, I am a bit surprised to see so little info about connecting it to MS SQL Server, which makes me wonder if it's perhaps a fool's errand or at least ill advised? We've successfully connected other PHP apps typically paired with mySQL to MS SQL Server by just providing and specifying the appropriate driver, so I was sure hoping that the same would apply here.
Again, please excuse my ignorance, and many thanks to any / all that are able to help me move this along!

@straighlight - would I be wrong in assuming that the OpenCart installation would, in part, create the database structure (tables, etc.) as part of its process? If so, wouldn't I need to actually run the installation specifying MS SQL Server as my backend database?
@ADD Creative - when you suggest modifying the file "install/controller/install/step_2.php" to get the mssql driver to show at install, are you saying that's where this properly altered code would go?
// DB
define('DB_DRIVER', 'sqlPDO');
define('DB_HOSTNAME', '127.0.0.1');
define('DB_USERNAME', 'Your_username');
define('DB_PASSWORD', 'Your_password');
define('DB_DATABASE', 'Databasename');
define('DB_PORT', '1433');
define('DB_PREFIX', 'oc_');
Is this at all ill-advised... to try to connect OpenCart to MS SQL Server? I know that it may not be the norm, as open source and MS SQL Server don't really go hand in hand, but with the popularity of OpenCart, I am a bit surprised to see so little info about connecting it to MS SQL Server, which makes me wonder if it's perhaps a fool's errand or at least ill advised? We've successfully connected other PHP apps typically paired with mySQL to MS SQL Server by just providing and specifying the appropriate driver, so I was sure hoping that the same would apply here.
Again, please excuse my ignorance, and many thanks to any / all that are able to help me move this along!
Yes the OpenCart installer creates the database tables. That code would be added to the config.php files not the installer.
I think you have at least 3 options.
1. Use 3.0.x.x and import the opencart.sql file into your database and manually write the config.php files. 3.0.x.x is also a bit more stable than 4 and I don't think the driver you link to is actually compatible with 4.
2. Modify the installer to use the MS SQL driver.
3. Install using another database and then import and use the MS SQL driver in the config.php.
I think you have at least 3 options.
1. Use 3.0.x.x and import the opencart.sql file into your database and manually write the config.php files. 3.0.x.x is also a bit more stable than 4 and I don't think the driver you link to is actually compatible with 4.
2. Modify the installer to use the MS SQL driver.
3. Install using another database and then import and use the MS SQL driver in the config.php.
Thanks again for the reply.
I've heard the suggestion / recommendation of installing OpenCart using another available database selection, like mySQLi, and then changing the config file after installation to use MSSQL a couple of times now. I feel like I'm not understanding this properly... if I choose to install OpenCart using mySQLi, for instance, won't the application's database objects be created by the installation in mySQL? So if I just change the config file after the installation to use MSSQL, how does the application's database objects get created in SQL Server? Really sorry if the answer is just "duh, you'd have to create them manually...", but I really want to try to make sure I understand that I'm contemplating getting into and if it's really worth it. Our existing ecosystem is built on MS SQL Server so if I'm going to use OpenCart it's going to have to live there, but I'm starting to think that perhaps I'm just trying to shove the proverbial square peg into the round hole.
Thanks.
I've heard the suggestion / recommendation of installing OpenCart using another available database selection, like mySQLi, and then changing the config file after installation to use MSSQL a couple of times now. I feel like I'm not understanding this properly... if I choose to install OpenCart using mySQLi, for instance, won't the application's database objects be created by the installation in mySQL? So if I just change the config file after the installation to use MSSQL, how does the application's database objects get created in SQL Server? Really sorry if the answer is just "duh, you'd have to create them manually...", but I really want to try to make sure I understand that I'm contemplating getting into and if it's really worth it. Our existing ecosystem is built on MS SQL Server so if I'm going to use OpenCart it's going to have to live there, but I'm starting to think that perhaps I'm just trying to shove the proverbial square peg into the round hole.
Thanks.
After install using the mysqli driver into a MySQL database. You would have to export the database from MySQL and then import it into your MS SQL database.
Who is online
Users browsing this forum: No registered users and 1 guest