database

How to unit test an object with database queries

I've heard that unit testing is "totally awesome", "really cool" and "all manner of good things" but 70% or more of my files involve database access (some read and some write) and I'm not sure how to write a unit test for these files. I'm using PHP and Python but I think it's a question that applies to most/all languages that use databa...

MySQL Results to a File

How do I write the results from a mysql query to file? I just need something quick. Output can be CSV, XML, HTML, etc. ...

Simple password encryption

What is a good, simple encryption scheme for protecting passwords in a database? I don't necessarily need anything that's hyper-secure nor do I need anything that's lightning fast, but those things would be nice. Primarily, I just want something that's easy to implement without being terribly slow or insecure. ...

Checklist for Database Schema Upgrades

Having to upgrade a database schema makes installing a new release of software a lot trickier. What are the best practices for doing this? I'm looking for a checklist or timeline of action items, such as 8:30 shut down apps 8:45 modify schema 9:15 install new apps 9:30 restart db etc, showing how to minimize risk and downtime. Iss...

Adaptive Database

Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities. For example, assuming an empty database (pseudo code): user1 = new User() // Creates the user table with a single id column user1.firstName = "Allain" // alters the table to hav...

What's the best way of cleaning up after a SQL Injection?

I've been tasked with the the maintenance of a nonprofit website that recently fell victim to a SQL injection attack. Someone exploited a form on the site to add text to every available text-like field in the database (varchar, nvarchar, etc.) which, when rendered as HTML, includes and executes a JavaScript file. A Google search of the...

Using Hibernate to work with Text Files

Hey all, I am using Hibernate in a Java application to access my Database and it works pretty well with MS-SQL and MySQL. But some of the data I have to show on some forms has to come from Text files, and by Text files I mean Human-Readable files, they can be CSV, Tab-Delimited, or even a key, value pair, per line since my data is as si...

Testing and Managing database versions against code versions

As you develop an application database changes inevitably pop up. The trick I find is keeping your database build in step with your code. In the past I have added a build step that executed SQL scripts against the target database but that is dangerous in so much as you could inadvertanly add bogus data or worse. My question is what ...

Tool for querying databases

I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily? ...

Delete Records from Access database, error while deleting

I have the following situation: I built an Access form with a subform (which records are linked to the records of main form via certain key). When I try to delete any record in the subform, I get the following message: “Access has suspended the action because you and another user tried to change the data” (approximate translation from Ge...

Does limiting a query to one record improve performance

Will limiting a query to one result record, improve performance in a large(ish) MySQL table if the table only has one matching result? for example select * from people where name = "Re0sless" limit 1 if there is only one record with that name? and what about if name was the primary key/ set to unique? and is it worth updating the qu...

How to benchmark a SQL Sever Query?

I'd like to know the standard way to benchmark a SQL Sever Query, preferibly I'd like to know about the tools that come with SQL Server rather than 3rd Party tools. ...

File database suggestion with support for multiple concurent users.

I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? Which one did you use, did you have any problems with it? ...

Strategy for identifying unused tables in SQL Server 2000?

I'm working with a SQL Server 2000 database that likely has a few dozen tables that are no longer accessed. I'd like to clear out the data that we no longer need to be maintaining, but I'm not sure how to identify which tables to remove. The database is shared by several different applications, so I can't be 100% confident that reviewi...

Managing multiple identical databases efficiently?

In Podcast #19, Joel fails to answer the question posed to him by Ryan from San Diego; how, if you have a database per client of a web application instead of one database used by all clients, do you "go about providing updates and enhancements to all databases efficiently?" I'm particularly interested in the answer to this. Does anyone ...

Minimalistic Database Administration

I am a developer. An architect on good days. Somehow I find myself also being the DBA for my small company. My background is fair in the DB arts but I have never been a full fledged DBA. My question is what do I have to do to ensure a realiable and reasonably functional database environment with as little actual effort as possible? ...

Embed Images in emails created using SQL Server Database Mail

Hi All, I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a .net app to generate & send the emails but, unfortunately, all I have is SQL Server. ...

Altering database tables in Django

I'm considering using Django for a project I'm starting (fyi, a browser-based game) and one of the features I'm liking the most is using syncdb to automatically create the database tables based on the Django models I define (a feature that I can't seem to find in any other framework). I was already thinking this was too good to be true w...

SQL Server 2005 Auto Updated DateTime Column - LastUpdated

I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate datetime ...

PostgreSQL perfomance monitoring tool

I'm setting up an web application with a FreeBSD PostgreSQL back-end. I'm looking for some database performance optimization tool/technique. Does someone know one? ...