Using MySql wit linq - asp.net

I have 2 questions for which I need help.
1)
I have developed an application where in I store the files(doc,xls,etc) in database. I have used LINQ to perform insert,update and delete. I have used MS SQL. Now, the requirement is that of using MySql. Can I use LINQ wit MySql. I searchd and found that LINQ only supports MS SQL and access. If it is decided that MySql should be usued, I dont want to go back to the traditional 3tier architecture. Can NHibernate can be used with MySql?
2)
How do the blade servers perform when it has to manage a data of 500gb+ data(documents). The RAM is about 12GB. Please nedd sugggestions that if such a huge amount of data is there, is it better not to store the data(documents) in database and store it in drives on the server instead.Because I have seen that if the data is stored in database(binary format) the size does increase.

Ok, here we go
1) It is not possible to communicate with an MySQL-Database via Linq To Sql, like you mentioned it is only build for MSSQL and Access. Prefer using the EntityFramework to communicate with variable databases. It is nearly the same to work with like Linq To Sql. You can easily develop your application using an MSSQL-Database and switch to a MySQL-Database after deployment by just changing your ConnectionString and installing the MySQL-EntityFramework-Connector.
These links may be helpfull to you:
Codeproject.com - An Introduction to Entity Framework for Absolute Beginners
Stackoverflow.com - Using MySQL with Entity Framework
2) I would advise you to store your data on physical drives and set references to the stored file in your database. This is because the heavy amount of data transferred while requesting one of your documents will slow down your database for other querys that normally just would take milliseconds to be executed.

Related

Migrating from MSAccessDB to SQLLite

I have a application written long time back using the MS Access as the configuration database. It was using OLEDB Provider (Jet Engine) for retrieving data from the configuration DB.
I intended to replace MS Access Db lightweight RDBMS which requires no additional installation requirements. Thinking of using SQLLite which seems to suite my needs. Wanted to check if anyone have invovled in migrating the data from MSAccess to SQL Lite. Is there an easy way to migrate the schema and data?
You can quite much transfer data and schema if you setup the ODBC driver for sqlite.
Once done then you can run append queries in Access to export to the sqlite database.
Of course with sqlite you don't get or have forms, reports or a coding language. So, you have to replace that part of Access with some other kind of development platform.
So, you need to get a ODBC driver for sqlite.
This one works well:
http://www.ch-werner.de/sqliteodbc/
So, once you done the above, then you can link from access to sql lite. You can even edit data with Access forms, or even run access reports against data in sqlite.

What is the fastest way of pulling data from a foreign database

I need to pull data from a single table stored in a MSSQL database. The data then gets stored in a staging table in AX, from where it is processed according to the business logic.
Performance is a key factor in this project.
Now I was doing some research of what are the possibilities to retrieve data from an MSSQL database with X++ code and found following blog:
Connecting to Databases through X++
Basically there are different ways which can be used for this endeavour:
ODBC - Open Data Base Connectivity
OLEDB - Object Linking and Embedding
ADO - ActiveX Data Objects
Connection Class
Now I was hoping that someone could give input of which one is preferrable and why (especially in regards to performance).
Any input is appreciated.
The connection class isn't a valid option because it connects to the same database AX is connected to, so your choices boil down to ODBC, OLEDB and the ADO/.NET way.
Personally I would go for the .NET integrated way (called OleDB in your link) but would use System.Data.SqlClient instead of System.Data.OleDb because it's natively written in .NET. If your code is compiled to CIL that should give you best results.
No matter what option for the retrieval you pick, you should really be building a recordinsertlist and perform a set based insert instead to optimize insert performance.
This sounds like a job for the Data Import/Export framework within Ax 2012.

ASP.NET - Is there an object that I can execute sql queries against?

I'm developing an application in asp.Net using VB and an Access database. My client has specified these, and I can't use more robust tools.
My application has to perform a sizable number of logical operations, and SQL is perfect for this. However, because of some of the limitations of Access SQL, I can't really write large SQL statements that do the whole job. Lacking logic testing like IF-ELSE, I'm stuck writing literally dozens of SQL statements. That would be OK, but I'm leery of all that activity against an Access database. Access isn't very stable when you work it that hard.
I've fooled around with funky solutions using things like the SWITCH function, but they look more like spaghetti than actual code. Wouldn't be maintainable at all.
I can upload all of the data into objects in memory and loop back and forth through them using VB logic, but SQL would sure be more efficient.
My question is: is there some object I can create in memory that I can run SQL against? Some recordset-kind of thing? Came up snake-eyes when I searched for this, but I thought I'd ask.
Thanks for any suggestions.
So if I understand your question correctly you currently have to use an Access database as the backend storage but you do not like doing this and would rather pull all data into the application (ASP.Net) and perform your queries against this as if the database was an SQL database in the application. I expect then that you would push the data back.
AFAIK no this cannot be done. While you could put most of the data into objects and do the manipulation there you will not have the relationships etc. but you could try using LINQ or entity framework.
This link below explains that you can do LINQ with MSAccess and that may give you the query power you want.
Query Microsoft Access MDB Database using LINQ and C#

ASP.NET MySQL WebApp Architecture

I'd like to know the best architecture.
We have a web application running different domains. Each domain has its own MySQL database but the db structure is the same for all of them.
We have a web application for the visible part of the application.
We have a dataLogic project
We have a dataEntities project
We have a dataAccess that contains only the methods to connect to the data base.
Before we called stored procedures on a database. But we had to change it because the performance was bad. Also, the problem was that every change we made we had in a stored procedure we had to copy to every database.
We are thinking in using a WebService to retrieve the data. Every domain can call the web service with a connection string and connect its database to retrieve data. This way when we change a SQL query we only have to compile the webService and change it, we don't have to change versions on multiples domains.
Also, what do you think about the SQL queries? Since we don't want to keep using stored procedures, what is the best way to do it? Directly from code?
Thanks
T
If you have multiple Database servers you will have to make Structural changes from one DB to another one way or another. There are many tools to change Database structures. These tools will look for differences between Schema, and will either generate the SQL code for you, or do the changes by itself (it depends a lot in the tool, there are powerful ones and not so powerful ones). Please do take a look at Toad for MySql. Now, for the Data changes, you may want to replicate the data from one Database to another. This is done through Replication.
We are thinking in using a WebService to retrieve the data. Every
domain can call the web service with a connection string and connect
its database to retrieve data.
This sounds like a good idea and since you already have "dataAccess" and "dataLogic" projects, it should not be too hard to make the services.
Also, what do you think about the SQL queries? Since we don't want to
keep using stored procedures, what is the best way to do it? Directly
from code?
I don't think it is a good practice to have the SQL queries directly into your code, but it depends in a lot of things, so I would suggest Stored Procedure vs Hard-Coding the queries, or LinQ (Entity Framework 4.1).
Good luck with your project and I will take a look at this thread frequently to see what you end up doing.
Have fun!
Hanlet

What is a good alternative to SQL Server for ASP.NET applications?

I've been looking into a lot of database's recently, and am not sure if it's because I'm bored or what, but I want to create a few web applications using database's other than MS SQL Server. Any suggestions that tie into ASP.NET nicely?
I'd recommend VistaDB and MySql.
I'd consider MySQL as the obvious alternative.
However, fundamentally one relational database is pretty much the same as another, more so when accessed through something like ADO.NET. If you're bored with SQL Server then rather than looking for an alternative why not look at trying different data access strategies?
You don't mention whether or not you're using an ORM (object relational mapper) which can make working with databases a lot more enjoyable than using standard ADO.NET, such as:
NHibernate
Entity Framework
Linq to SQL
Subsonic
IMO, sticking with SQL Server but trying out a few different ORM's would be much more interesting than switching to a different database altogether.
Or how about looking into using a document database, such as RavenDB?
I suggest you take a look at Connectionstrings.com. Most databases there have a .NET provider available.
Define "good".
Do you want to have a database as a simple data store, or should the database also implement business logic (stored procedures, triggers)?
Do you want to ship your apps and therefore require easy of installation?
Does it matter if the database is commercial, when MSSQL offers a free version?
As #richeym pointed out: are SQL statement a sufficient interface, or do you require an ORM?

Resources