database

Best practise when updating individual fields in a database record

I have created a Data Access Layer using .NET. Everywhere that I update a database record, I have used sql along the lines of UPDATE Customer SET FirstName=:FirstName, LastName=:LastName, Address1=:Address1, Address2=:Address2,....etc This means that every field in the record is updated, even though only one field may have been cha...

Storing Sessions in DB Table Not Working (using Zend_Session_SaveHandler_DbTable)

This is my table: CREATE TABLE `Sessions` ( `id` varchar(32) NOT NULL, `modified` int(11) default NULL, `lifetime` int(11) default NULL, `data` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB This is in my bootstrap: $sessionConfig = array( 'name' => 'Sessions', //table name as per Zend_Db_Table 'primary' => 'id', ...

Performance: Templates in a Database or a File?

What is the fastest way to store templates? In a database (SQL Server) or a file? Those template can be from 1KB to ~15KB (usually 1-3KB). After reading the template, I'm parsing it with Regex to HTML. I've <div>[Block Parameter="Value" Parameters2="SomeValue" ...]</div> for example, so please consider that. Thanks. ...

Why is Magento so slow?

Is Magento usually so terrible slow? This is my first experience with it and the admin panel simply takes ages to load and save changes. It is a default installation with the test data. The server it is hosted on serves other non-Magento sites super fast. What is it about the PHP code that Magento uses that makes it so slow, and what ...

SQL Server 2005 Identity Specification not respecting seed value

I am in the process of converting an Access database to SQL Server 2005. I have successfully migrated the data and original schema using SSMA and am now in the process of normalizing the database, which requires me to add a few unique identifiers. Some of the columns we had were previously created using an AutoNumber data type, which is...

Data Structure for storing a sorting field to efficiently allow modifications

I'm using Django and PostgreSQL, but I'm not absolutely tied to the Django ORM if there's a better way to do this with raw SQL or database specific operations. I've got a model that needs sequential ordering. Lookup operations will generally retrieve the entire list in order. The most common operation on this data is to move a row to th...

Question about Security in a live search field

This is an odd question. I have a friend who is working on an application. There is a table with 4 fields that holds a word and a definition among some other things. On a website there is a textbox in which a user can enter a string and the database is queried and looks for similar content while the string is being entered in the box. (A...

Connecting to a MySQL database.

How do I connect from Java to a MySQL database? The Java is run on a local machine while the Database is on a server. ...

Database replication and migration schemes

Hi, We are looking at database replication for rolling deploys. It gets complicated as our deploys involve data migrations too. What would be a good replication scheme. I guess my question is on how to setup the replication. Supposing we have 4 webservers and 2 database servers, how do I make the update so that all the writes are repl...

Copy data from an SQL Server 2005 database to Access 2007 database with a different schema in C#

I have data in an SQL Server 2005 database which I need to copy to an Access 2007 database. It is a database conversion tool. Essentially each table corresponds to a table of a different name and within each table each column needs to be mapped to a corresponding column in the Access 2007 database. Just wondering what is the easiest way...

How do I select min/max dates from table 2 based on date in table 1?

I have a monthly table (only holds rows with first day of month, and unique constraint so only one of each) and a daily table with similar information for each day (same deal, only one per day): Monthly table Daily table ------------- ----------- 2009-01-01 2009-01-01 2009-02-01 2009-01-02 : : ...

Amazon RDS: can databases be setup in replicaton mode?

I am studying the new Amazon RDS product and it seems it can be scaled only vertically (i.e. put a stronger server). Did anyone see a possibility to configure multiple instances so that one is master and the other/s is/are replication slaves? ...

Provide a database packaged with the .APK file or host it separately on a website?

Here is some background about my app: I am developing an Android app that will display a random quote or verse to the user. For this I am using an SQLite database. The size of the DB would be approximately 5K to 10K records, possibly increasing to upto 1M in later versions as new quotes and verses are added. Thus the user would need to ...

Modern equivalent to Foxpro, Access, etc. ?

Is there a modern day equivalent to Foxpro, Access, and so on? I'm looking for a programming environment that has database access built in as one of its most fundamental features. Something where the table data can be very easily tied into the GUI without having to write loads of glue code. Also preferably one that compiles down to an ...

Get the maximum value of rows from database table

I need to write a SQL query which will get me those rows from the table which have the max value of files. The database table is as follows: > ID status dept files > > > 1 1 23 1256637314 > > > > 1 1 39 1256642968 > > > > 2 0 85 1256551419 > > > > 2 1 90 1256642968 > > > > 2 1 93 1256810937 > > > > 3 0 20 1256642968...

Handle transactions for two independent data sources as one

I have two data sources: a legacy one (web service) and a database one. Now, when I process request, I made changes to both. In case of error, I want to rollback both. try { legacy.Begin(); db.Begin(); legacy.MakeChanges(); db.MakeChanges(); } except (Exception) { legacy.Rollback(); db.Rollback(); } The problem is, what if legac...

Django db reset without loading fixtures

Is there an easy way to reset a django database (i.e. drop all data/tables, create new tables and create indexes) without loading fixture data afterwords? What I want to have is just an empty database because all data is loaded from another source (a kind of a post-processed backup). I know that this could be achieved by piping the out...

Alternative language to TSQL for data handling

If I wanted to create my own relational database with a modern language to replace TSQL, what language would that be? Or if I end up creating my own language, what features would I have to include to make it better than TSQL ? ...

Purging SQL Tables from large DB?

The site I am working on as a student will be redesigned and released in the near future and I have been assigned the task of manually searching through every table in the DB the site uses to find tables we can consider for deletion. I'm doing the search through every HTML files source code in dreamweaver but I was hoping there is an aut...

Adapt an existing database to a django app

I have a Postgresql databese with data. I want to create a django app with that database. How can i import the tables to django models and/or views? ...