How to connect opencart with mssql server - sql-server

Is there any chance of connecting opencart with mssql? Have anyone tried? If so what is the procedure of doing that?

That should not be a big problem, You only need to do:
create /system/database/mssql.php class - the class should have the same methods, properties and functionality as e.g. the mysql.php one
rewrite all of the model classes method's queries to meet the MS SQL / T-SQL SQL syntax
in both config files (/config.php and /admin/config.php) set the proper DB_DRIVER - mssql
I am supposing You have the OpenCart database created already due to the /install/opencart.sql file.
I guess nothing more should be done.
Anyway, what is the reason for switching to MS SQL?
EDIT: In /system/database/ there is this mmsql.php file which actually contains the MSSQL class thus this do not have to be implemented, just renamed to mssql.php file.

Related

Database and Dataset data is empty [duplicate]

Apparently, using AttachDbFilename and user instance in your connection string is a bad way to connect to a DB. I'm using SQL server express on my local machine and it all seems to work fine. But what's the proper way to connect to SQL server then?
Thanks for your explanation.
Using User Instance means that SQL Server is creating a special copy of that database file for use by your program. If you have two different programs using that same connection string, they get two entirely different copies of the database. This leads to a lot of confusion, as people will test updating data with their program, then connect to a different copy of their database in Management Studio, and complain that their update isn't working. This sends them through a flawed series of wild goose chase steps trying to troubleshoot the wrong problem.
This article goes into more depth about how to use this feature, but heed the very first note: the User Instance feature has been deprecated. In SQL Server 2012, the preferred alternatives are (in this order, IMHO):
Create or attach your database to a real instance of SQL Server. Your connection string will then just need to specify the instance name, the database name, and credentials. There will be no mixup as Management Studio, Visual Studio and your program(s) will all be connecting to a single copy of the database.
Use a container for local development. Here's a great starter video by Anna Hoffman and Anthony Nocentino, and I have some other resources here, here, and here. If you're on an M1 Mac, you won't be able to use a full-blown SQL Server instance, but you can use Azure SQL Edge if you can get by with most SQL Server functionality (the omissions are enumerated here).
Use SqlLocalDb for local development. I believe I pointed you to this article yesterday: "Getting Started with SQL Server 2012 Express LocalDB."
Use SQL Server Compact. I like this option the least because the functionality and syntax is not the same - so it's not necessarily going to provide you with all the functionality you're ultimately going to want to deploy. Compact Edition is also deprecated, so there's that.
Of course if you are using a version < SQL Server 2012, SqlLocalDb is not an option - so you should be creating a real database and using that consistently. I only mention the Compact option for completeness - I think that can be almost as bad an idea as using AttachDbFileName.
EDIT: I've blogged about this here:
Bad Habits : Using AttachDBFileName
In case someone had the problem.
When attaching the database with a connection string containing AttachDBFile
with SQLEXPRESS, I noticed this connection was exclusive to the ASP.NET application that was using the database. The connection did block the access to all other processes on the file level when made with System.Data.SqlClient as provider.
In order to assure the connection to be shareable with other processes
instead use DataBase to specify the database name in your connection string
Example or connection string :
Data Source=.\SQLEXPRESS;DataBase=PlaCliGen;User ID=XXX;password=ZZZ; Connect Timeout=30
,where PlaCliGen is the name (or logical name) by which SQLEXPRESS server knows the database.
By connecting to the data base with AttachDBFile giving the path to the .mdf file
(namely : replacing DataBase = PlacliGen by AttachDBFile = c:\vs\placligen\app_data\placligen.mdf) the File was connected exclusively and no other process could connect to the database.

Unable to take a snapshot of a database which contain "-" in its name

I have a SQL Server database named db-pwapp-lostandfound-dev, and I want to take a snapshot of it, but I am getting this error - seems like SQL Server does not like - in the name:
I tried to surround the name by [], but I still have the same issue:
Any advice ?
Thanks
The issue is that you are using Azure SQL Database, and it does not support CREATE DATABASE AS SNAPSHOT.

Entity Framework Data First - Invalid Object Name dbo.TableName

sup?
I got this problem wich has been slowing down my production a lot, hope u guys can give me any tip on how to solve it....
I'm currently using EF6 and a custom ConnectionString with a connectionString builder class that reads and external xml file.
My database is all set up and running in SQL 2010 and Management Studio ok, but whenever I generate the edmx file, it generates the class mappings okay, I've compared the original ConnectionString to my ConnectionString Builder they're the same, changed the :base to receive a custom ConnectionString, all set.
But when I try to save changes it doesn't find the table object, I have deleted it, created again from the start, still same "Invalid database object Dbo.TableName" error.
Does any one have a clue on this?
Thanks in Advance!
This error is not coming from Entity Framework but directly from the database.
Use SQL Profiler and include in the trace the "DatabaseName" and "ServerName" and you will find out it's not the same as your expected.
The only other options which this issue happen is if your "tableName" is not the same as the table name in SQL, so run the SQL from the SQL Profiler directly into SSMS.

Accessing a non JDBC DB using mapreduce

I have a database which is not JDBC enabled where I am able to fire a query and get the result using an input stream. I want to access this using a map reduce program.
For a JDBC enabled database there are "DBInputFormat.java" and "DBConfiguration.java" files in Hadoop which take care of accessing the database and getting the result in a user-defined class which extends DBWritable and Writable interfaces.
Is there a way in which I can access the above mentioned non-JDBC database in the same fashion ?
I am not sure if your DB supports ODBC. If so you can try jdbc:odbc driver with DBInputFormat. I am not sure if this works as never tried this.
Another option which should be your final option is to implement your own FileInputFormat

Setting up a Entity Framework Code First Database on SQL Server 2008

I successfully created my first Entity Framework Code first project using SQL Server CE. The database tables were created automatically and all was well.
I then changed my connection string to point to a SQL Server database I'd created and expected it to autogenerate the tables. It didn't and instead complained about the tables not existing.
After some reading I found that I needed to add an initializer to my App_Start method.
I tried:
// Method 1
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<EFContext>());
But this didn't work at first because it couldn't find an EdmMetaData table to discover if the model had changed.
So I tried adding:
// Method 2
Database.SetInitializer(new CreateDatabaseIfNotExists<EFContext>());
But this didn't work because I'd already created the database, and when I removed the database it still didn't work because the user I was logging in as didn't have create database privileges.
I finally tried:
// Method 3
Database.SetInitializer(new DropCreateDatabaseAlways<EFContext>());
Which worked, but I don't really want to drop the db every time. So once it ran and added the EdmMetaData table I replaced it with method 1 and that now works fine.
Although this method works, it doesn't feel as elegant as when I was using SQL Server CE and I've not found someone suggesting that you use this method.
So, am I missing something and is there an easier, more elegant way to do this?
Method 1 and 2 expects that database doesn't exist yet. They don't work if you create database manually. If you need EF to create tables in existing database you must create custom database initializer.

Resources