How many of you are using Source Control for your database? - database

If you are using source control for your database? which db type is that?
If not, may I ask why not?

Related

Confused by Excel ODC connection files

So I was making a new connection to an MS SQL server using the wizard and realized I don't know REALLY why it has me save these ODC connection files.
So, what are they and why does Excel create them?
Further, what happens to these files once when I change the connection from just selecting a table, to a custom SQL statement I have created?
Does anything change in these ODC files? I know sometimes it complains that if I make a change it will no longer match what is stored in the file.
edit:
I decided to look into one of my ODC files and it is HTML combined with some XML tags and then even a little JavaScript. So that is interesting. Still not sure how Excel uses these files instead of just storing that data itself. I guess to provide connections to multiple workbooks.
I think the idea is that you can share these files. You could put an odc on a network share or on SharePoint, have multiple workbooks use the odc file, and if any updates were necessary (like the database moved), then you only have to change it in on place.
Also, if you double click the odc file, it will create a new workbook with that connection and a table. I guess that could be a lean way of sending a workbook that consists of only an external data table to someone with access to the same connection. I haven't used that myself, but, you know, theoretically...
Why did they choose this as the default? I don't know. I wouldn't have. I would have chosen to have the data stored in Excel, but still have the ability to Export an odc for those that want to go that route. I'll bet the vast majority of external data tables have an odc sitting in My Documents and the user isn't even aware of it.
But pre-tablet MS Office seemed to base their design decisions on what their biggest clients wanted. And since there really isn't a cost to the average user (other than warnings they may not understand), why not.

create a database from installer file?

well for example you have build a program, for restaurant, for a cinema, wherever,
now how do you do when, you install your application, the database was installed correctly too? i dont sure but i believe this is a different database? for example a file?
(talking about sql).
and how different are going to be the queries? cuz i believe i am not going to have the same function on sql server than a file database
and what connection i shall use?
could i use entity framework?
and how capacity could to have the different file for databases?
regards
You can use a file-based database like SQLite that supports SQL queries. There are ADO adapters available as well. The link should take care of the rest of your questions as well.
Well, since you usually have absolutely no knowledge about target environment, user must configure program to his envronment at install time, or later (af first launch for example, this is much simplier than implement same functionality in installer). User specifies SQL server address (if we are talking about server-based systems) and database name he wants to use. Then database is created programmaticaly using that information.

different levels of user accesses to an SQLIte Db file

I know that SQLite doesn't support setting up different users. I have a requirement where I need to prevent certain set of users from doing INSERTS/UPDATES into the SQLite DB. As SQLite doesnt have any GRANT/REVOKE commands is there any other way to setup different access levels to the DB file apart changing the file permissions.
Thanks.
Not built into sqlite, no.
You could write your own access control, however. Many web projects are an example of this model. They regularly authenticate against user records contained within the database itself.

SQL Server source control

I'm planning to use source control for SQL Server database. I have different versions of SQL Server (2005 and 2008) running on different machines (Windows 2003 and 2008). I looked up about source control and found out 2 options.
http://nobhillsoft.com/Randolph.aspx
http://www.red-gate.com/products/sql-development/sql-source-control/
So I was just wondering if someone have experience with them and suggest me which one would be good out of these or any other better option?
Thanks!
In my opinion, you may be approaching something here from the wrong angle. If you try to revert a change to the table structure, but the table has been populated with data fitting the new table structure, what happens? It's more complex than maintaining plaintext diffs. I encourage you to really look at the idea and see if you can accomplish this another way, and document your database design as completely as possible every time you need to change it.
That being said, here are some more ideas.
http://www.sqlservercentral.com/Forums/Topic753558-361-1.aspx
http://www.sqlservercentral.com/Forums/Topic635185-145-1.aspx
I compare all these options and going with Red-gate source control and data source solution. Thanks for all suggestions!
You can use your current version control system if it's suitable for you to store only installation SQL script of a database.
Use SSMS to produce installation script: right-click on desired databased, select Tasks -> Generate Scripts... Script Wizard will start and help you to script any objects you need in the database including data. Save this script under your version control system since it's text file.
Use this database installation script to reproduce the database at desired location and environment.

WPF application with MS Access database as a data source

I have a Microsoft Access 2010 database(*). Now, using Visual Studio 2010, I want to create a WPF application and add the database as a data source. The app will have a window with a frame that provides navigation through pages. No problem so far. But:
-What is the right way to set up the database in this scenario? Tables only? Or must everything go via queries? (VS2010 talks about views which I assume (?) are queries)
-Database data must be updatable and records can be added. Some relationships go through link tables (many-to-many) and there are nullable foreign key relationships. Must I take manual steps to make it work?
-While adding the data source VS2010 created an xsd from my Access database. I think the xsd might need further tweaking for the application to work the right way. What if I change my Access database design, I'd have to regenerate the xsd again as well. Is this right, and is it the way it is usually done? OR, should I let the original Access database go and give the application the capability to create new empty databases?
-How do you provide controls in a page to step through the records in a table? Is there a special database control?
-What is the way (WPF class?) to load records into the data context that displays in a page? (At this level it probably does not matter what type of data source it is.)
(*) A single user desktop database
This is not the exact answer to the question. But an alternative.
Is this a single-user database?
You can try this better and highly efficient combination:
SQLITE (DataBase)
DBLINQ (ORM)
LINQ(a .NET framework component for querying the db)
You should also take a look at ObservableCollection, DataBinding and DataGrid in WPF toolkit.

Resources