database-agnostic

How do I normalise this database design?

I am creating a rowing reporting and statistics system for a client where I have a structure at the moment similar to the following: ----------------------------------------------------------------------------- | ID | Team | Coaches | Rowers | Event | Position | Time | -------------------------------------------------...

Software as a service - Database

If I am building a CRM web application to sell as a membership service, what is the best method to design and deploy the database? Do I have 1 database that houses 100s of records per table or deploy multiple databases for different clients? Is it really an issue to use a single database since I believe sites like Flickr use them? ...

Database design for tags and URL

I'm building simple application for myself in JSP which stores URL for me and finds it based on tags. For which i want to design a database. I'm limited with my knowledge of SQL. But still i want to learn by doing. I want to create database that stores tags for the URL and the URL itself. The URL could be text(50) or more in a table co...

Difficult Temporal Cross-Table Database Constraint

I have a particularly difficult business constraint that I would like to enforce at the database level. The data is financial in nature, and so must be protected from inconsistencies to the nth degree – no trusting the business layer with this stuff. I use the word "temporal" somewhat loosely, meaning that I intend to control how an enti...

Database neutral .NET application

Many product developers want to write a .NET application which will work seamlessly with any popular RDBMS like SQL server, oracle, DB2 , MySql. If we use the Data application block it dynamically picks the database driver (OracleClient, SQLClient or OleDBClient) based on configuration. However, all databases have their own flavours of...

Database independence

We are in the early stages for putting a design for a big business application that will have multiple modules. One of the requirements is that the application should be database independent, it should support sql server, oracle, mysql and DB2. From what I have read on the web is that database independence is a very bad idea, it would r...

Agnostic Connection Handlers in .NET

Hello all, I'm developing a simple database acessor for a system, but i need to support 2 databases, PostgreSQL and Oracle (XXg); A example would be like this (already working for pgsql) ... bunch of properties, constructors and fields private String BuildConnectionString(); public Int32 ExecuteNonQuery(NpgsqlCommand sqlCommand); p...

design for 'simple' inventory system

Hello! I want to make a relational database system for a local computer hardware non-profit. There are two inter-related features that I want to figure out how to implement. First, we need to manage our inventory of parts, and second, we need to track donations of computer systems as they come into us, and also as we grant them out. Fir...

Is it possible to search for dates as strings in a database-agnostic way?

I have a Ruby on Rails application with a PostgreSQL database; several tables have created_at and updated_at timestamp attributes. When displayed, those dates are formatted in the user's locale; for example, the timestamp 2009-10-15 16:30:00.435 becomes the string 15.10.2009 - 16:30 (the date format for this example being dd.mm.yyyy - hh...

What happens when a table in a databse has more rows than the max size of the index data type?

For example if i have a unsigned int index in my table, what happens when i get more rows than sizeof(unsigned int) ? I'm interested in MySQL/PostgreSQL/MsSQL. ...

What orm.xml features should be avoided to stay database agnostic?

I'm embarking on an adventure in JPA and want to, inasmuch as possible, stay database agnostic. What orm.xml features should I avoid to stay database agnostic? For example, if I use strategy="AUTO" in orm.xml as follows: <id name="id"> <generated-value strategy="AUTO" /> </id> ...then MySQL shows it as an AUTO_INCREMENT column w...

How can this SQL query code be broken/exploited by user input?

Possible Duplicate: Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? We have a legacy app that doesn't do queries using positional parameters, and there's SQL everywhere. It was decided (before I started here) that since user input can contain apostrophes, every string...

guarantee child records either in one table or another, but not both?

I have a table with two child tables. For each record in the parent table, I want one and only one record in one of the child tables -- not one in each, not none. How to I define that? Here's the backstory. Feel free to criticize this implementation, but please answer the question above, because this isn't the only time I've encountered...

CakePHP Multiple Nested Joins

I have an App in which several of the models are linked by hasMany/belongsTo associations. So for instance, A hasMany B, B hasMany C, C hasMany D, and D hasMany E. Also, E belongs to D, D belongs to C, C belongs to B, and B belongs to A. Using the Containable behavior has been great for controlling the amount of information comes back...

Does this behavior exist in all major databases?

mysql> select 0.121='0.121'; +---------------+ | 0.121='0.121' | +---------------+ | 1 | +---------------+ Does it hold for other database that number='number' is true? ...

The entity framework and database agnostic programming, possibilities?

We want to use the Entity Framework (.NET 4.0) to build applications that can deal with Sql Server, MySQL and Oracle. And maybe Sqlite too. It should be easy to switch the db vendor by some setting in a config file. Is this possible? I prefer real life examples! What kind of providers did you use? ...

SELECT DISTINCT on a field not appearing in recordset?

I want to do a SELECT DISTINCT guid, ..., but I don't want guid appearing in the recordset. How do I do this? ...

Database Independent Tool in Java

What all things you need to take care if you want to write Database Independent Tool in Java? I know we can use hiberante and corresponding HQL queries to make sure that there is no database specific queries. We also need to maintain the DDLs for different databases or we can use ddlutils to maintain the DDLs(I am not sure how stable is ...

How to group the records according to the range in SQL

Hi I would like to create a SQL to group the records according to the range For example, suppose I have Number Time Price 100 20100810 10.0 100 20100812 15.0 160 20100810 10.0 200 20100810 12.0 210 20100811 13.0 300 20100811 14.0 350 2010081...

Appropriate query and indexes for a logging table in SQL

Assume a table named 'log', there are huge records in it. The application usually retrieves data by simple SQL: SELECT * FROM log WHERE logLevel=2 AND (creationData BETWEEN ? AND ?) logLevel and creationData have indexes, but the number of records makes it take longer to retrieve data. How do we fix this? ...