how to save large files - WAMP server, Database - database

I am creating a database on a WAMP server, running locally on my machine for now. I want to organize audio files, I understand I can use BLOB in the database but this is apparently very slow. I thought the best way would be to use a database with a reference to the location of the audio file. How do you achieve this using WAMP server? I have created the database, I need to add a folder of some onto the server. Also is there any other way of trying to get where I want?

Problem resolved by using folder on saved on the server and using webclient class (C#) to upload the file and SQL to alter the database which holds information on that file, including the location in the server.

Related

Azure Storage to Azure SQL Server using FunctionApp

I have one Storage Account on Azure where I get lots of json files from somewhere. I am running an exe on my computer constantly to get the Json File and read the data from json and convert the data into table and upload it on an SQL Server database on azure - A synchronization process
I have not worked with WebJob or FunctionApp
I believe this can be done by FunctionApp triggering on blob. I am not sure if I will be able to do the complete process as I do locally on FunctionApp.
Is this the right decision for this purpose or would you suggest WebJob for this?
If you prefer to use azure web jobs, this should be as simple as just uploading a .zip file of your project. You can follow this article to create the webjob, and the webjob should work as what you do locally.
If you prefer to use azure function, then you can use blob trigger do the same thing, but you may make some changes as per your need.

Deploy Umbraco website

I've been working with Umbraco to create my first website.
So far I almost completed the framework of my website and now I'm thinking about how to move it to my server. My idea is to upload my website when the framework is ready, and then create the contents remotely. I'm updating an existing website, which means that the host server already hosts one website, which I have to replace with the one I'm creating with Umbraco.
How can I do the deploy of the website?
Have to install Umbraco at the host server?
What about the Database?
I will use the database of the host server. I want to upload my new website, but still keep the old one in case something goes wrong. Please keep in mind that I'm a total newbie at this and have never uploaded any website. Would really appreciate your help!
Thanks in advance, have a great day!
Depending on the capabilities of your hosting provider. Create a new folder on the server and place there your Umbraco files.
And change the IIS webroot location to the new folder. (by changing it to the old location your old site is back again)
And you need to backup your local database, and restore on the database server from your hosting provider. and configure the connectionstring.
At low end hosting providers you can often not restore database backups.
one option may be to generate a SQL script including data. (often you need to change the database schema,user to the one you own on the hosting provider) Otherwise, start with a clean database and import your Umbraco items with a Umbraco package.

Sharing source for an ASP.NET MVC project that has a database

I have a very simple database (just 3 tables and a dozen rows or so each) that is designed for use with an ASP.NET MVC 5 project. I am using Visual Studio 2013 Ultimate.
I want to be able to post my Visual Studio solution for others to download and learn from. These examples will often be Visual Studio ASP.NET MVC solutions that appear in my blog. I've successfully publish console-type applications but I've never published any applications that use a database.
In my current project, I'm using a connectionstring that begins with "Data Source=(localdb)\v11.0". What I don't understand is how to provide a copy of my existing database to my reader. Is it a physical file on disk? If so, where is it (it doesn't appear as a path in the ASP.NET/MVC-provided default connectionstring) and how can it be included in a downloadable Zip file for others to easily download and install? Does NuGet or GitHub somehow automate this process? For the records, I googled around and also didn't find any articles that discuss how to do this (admittedly, I used the search terms "share" and "database" and saw a lot of hits having to do with network sharing--not what I intended...).
Finally, if at all possible I want my users to be able to download the solution/project files and run the project successfully right away. I don't want them to have to go into web.config and edit connectionstring or other system/configuration/environment values.
There is no information on what type of database you are using ? i.e. (SQL SERVER / My SQL / Oracle)
Would share you on SQL Server and to share your Local Project with Database. There are two ways through which you can share Project (including database).
Share the BAK file with Project - Take Backup of your project and include the same in the Project ZIP file and upload. So if any user downloads it then it will restore the BAK file (Database file) and then can connect down project with database.
Share the Physical file (MDF and LDF) with Project -
(a). By default, MDF and LDF files are located in SQL Server >> MSSQL >> Data
(b). Concerned database MDF file should be taken and added in ZIP file (c). Person downloading will extract the file and Use SQL Management Studio >> Database >> "Restore Files and Filegroups" option (d). Restore the database and run the project

Packaging Images with SQL Server Script

i have a sql server db which needs to be deployed with an asp.net application. In a particular master table data is populated via a batch when installing the app. There are some images which must be saved in the db during installation. How do I package these images and how do I supply the path to these images ?
In SQL Server, they will end up as binary data. So you can script them out as a hexadecimal string, like this:
INSERT INTO myTable(ImageColumn)
VALUES (0x104321943324798543...)
That's the simplest way. There are plenty of tools that can do the scripting for you, the IDE that I wrote (which you can find here) included.

LINQ to SQL and the DBML file - multiple database development

The way I develop may not be correct, any advice welcome.
At the moment I have a WPF application that uses a SQL2008 database. I have a copy of the database on a laptop and on my home machine. My application is versioned using SVN and I am obviously able go from the work laptop to the home machine and update/commit as required to ensure I am using the latest code for the application.
However the database is a different story in that any change I make I create a backup and then transfer the backup to the other machine etc. This way I get the data and the changes made on each system. In order to do this the database connection using a different connectionstring and I change a setting in my app to use a different connection based on my location.
I have now started to use LINQ to SQL and DBML files in my application, and finally getting to the question, I don't know how I can change the connectionstring it uses in code so it will use the correct database in the DBML.
Also, is there a better way to transfer the database so I don't need to do the backups and restores? The only reason why I have not versioned the Schema is because I am not sure how that would handle my data as this is key to my development, ie various environment settings etc are stored in the DB and brought through at runtime.
Your Statement:
I have now started to use LINQ to SQL and DBML files in my application, and finally getting to the question, I don't know how I can change the connectionstring it uses in code so it will use the correct database in the DBML.
Yes it's possible.
MYDataContext mycontext = new MYDataContext("Your Connection String");
There is a Constructor where you can chage the Connectionstring.
This is such a common problem, and I have never found a minimal and clean solution to it. How to keep all the values and variables and databases and source files in sync between machines?
Well SVN works great for the source files.
For the database, I TRY to just use one DB if we can get away with it. All the devs point to one machine that hosts the db, then we aren't wasting time with DB setup and merging. If that's not possible, then we usually just end up dumping the database when there is a change and distributing the .bak file around. You can try adding this file to SVN, and it works. you can even have the DB dump to a schedule so that SVN is always getting a new copy. But it's still too much work to keep restoring a db over and over. Perhaps you could hook in some scripting to SVN (we use Tortise for windows) and have a job that would do that automatically. That'd be nice.
For the config files - I do ASP.NET so I have web.config, connectionstrings.config, etc, I do one of two things - either just manually copy sections that need to be changed between machines and comment out the part that doesn't need to be used (clunky), or I've at times written ConfigurationSettings helper objects that diagnose a config key to decide what setting to use, based on the current machine name. eg:
Say my current machine is DEV1. The server is SERVER1. I'll have config keys with names like DEV1.connections.sqlserver and SERVER1.connections.sqlserver. In the code I'll use the helper method GetConfig("connections.sqlserver"). GetConfig figures out which key to use based on the current machine name.
Using this method, I don't have to keep remembering to monkey around with the dozen .configs every time I upload to the server or change things. But I DO have to make a duplicate key for every machine that will be running the application, which can get a bit much. For large teams, instead of using machine names, I use group names and have a config key that assigns machine names to a group - with the idea that every machine in the group will have that application set up in an identical fashion - same file paths etc.
Now onto your second question about LINQ - when you create a linq dbml, it will add a connection string to your config. you just have to make sure that you find this connectionstring and copy it into your active application. eg:
I have a solution that has 2 projects:
1 - website
2 - library
I put the dbml into the library project. If I go and look into the App.config of the library project, I'll see the connectionstring that LINQ wants to use. If I copy this connectionstring into the website's connectionstrings.confing file, when I reference the library and run the website, LINQ will be able to see the connectionstring it wants to use.
You can try Sql Server Merge Replication and use SQL Compact 3.5 as your laptop database and use master as your work/home machine database. However you may do this with only Sql Server Standard Edition.
Other option is , Microsoft Sync Framework.. here..
http://msdn.microsoft.com/en-us/sync/default.aspx
You could use red_gate's SQL COmpare and SQLDataCompare to script out changes to the database. You should be in the habit of scripting database changes anyway as that is what you will need to do when it is time to move changes to prod. I would also make sure all database changes are in SVN, we don't make any changes to the database ever without a script in source control.
I ended up just using multiple connection strings and then manually changing the connection on the dbml file whenever I moved locations. However I also have some code in place to programmatically change it based on the project setting for the location.
I haven't really got a good solution to the transferring of the databases and continue to use the backup and restore method.

Resources