database

How do I rename a column in a database table using SQL?

If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible? This is for any database claiming to support SQL, I'm simply looking for an SQL-specific query that will work regardless of actual database implementation. ...

Using stored procedures for calculations.

I am currently working on a project that will store specific financial information about our clients in a MS SQL database. Later, our users need to be able to query the database to return data from the clients based on certain criteria (eg. clients bigger then a certain size, clients in a certain geographical location) and total it to us...

How do you set up database testing using the PHP SimpleTest framework

I am using SimpleTest, a PHP-based unit testing framework. I am testing new code that will handle storing and retrieving website comments from a database. I am at a loss for how to structure the project to test the database access code. I am looking for any suggestions as to best practices for testing db code in a PHP application. Examp...

Is there any alternative to stored procedures?

Is there any alternative to stored procedures, secure and fast as well as stored procs. i know only Hibernate. Is there any other technologies like that? ...

DB2 Online Database Backup

I have currently 200+ GB database that is using the DB2 built in backup to do a daily backup (and hopefully not restore - lol) But since that backup now takes more than 2.5 hours to complete I am looking into a Third party Backup and Restore utility. The version is 8.2 FP 14 But I will be moving soon to 9.1 and I also have some 9.5 data...

Import Text File into generic Database using SQL

Hi, I am currently trying to import a semi-colon delimited text file into a database in c# using OleDb where I don't know the type (SQL Server, Access, Oracle, MySQL, postgreSQL, etc.) Currently I'm reading in the file as a database using the Jet text reader then creating a prepared insert statement, populating the fields, then commiti...

Pro's of databases like BigTable, SimpleDB

New school datastore paradigms like Google BigTable and Amazon SimpleDB are specifically designed for scalability, among other things. Basically, disallowing joins and denormalization are the ways this is being accomplished. In this topic, however, the consensus seems to be that joins on large tables don't necessarilly have to be too ex...

How can I use the TRUNCATE sentence avoiding MySql to write it into the binlog?

It seems MySQL does not support the flag "NO_ WRITE_ TO_ BINLOG" for TRUNCATE. So I have to wait until delay is 0, then stop the replication, make the TRUNCATE of the table/s, reset the master, and then start replication again. Really painful. Any other suggestion? ...

When you are abstracting your database records and datasets into objects, what does your object model look like?

I'm asking all of you who aren't using a library for this, but are constructing your own objects for managing data flowing to and from your database tables. Do I have a recordset object? one object per row of data? Both? Neither? Any suggestions or experiences welcome. Please don't tell me to use an ORM or other such toolkit. It's ov...

Object database for Ruby on Rails

Is there drop-in replacement for ActiveRecord that uses some sort of Object Store? I am thinking something like Erlang's MNesia would be ideal. Update I've been investigating CouchDB and I think this is the option I am going to go with. It's a toss-up between using CouchRest and ActiveCouch. CouchRest is pretty mature, and is used in...

Why recordsets initially were forward only

I have seen recent updates in term of record sets being updated so that we can scroll back and forth through the data it points to. My question is why they were initially designed for a forward only traversal. Is there any impact using the new version? ...

Updating client SQL Server database structure from text file

We have a "master database structure", and need a routine to keep the database structure on client sites up-to-date. A number of suggestions have been given to a related question, but I am looking for a more specific solution, along these lines: I would like to generate a text file (XML or other readable format) which describes the en...

Sqlite on an embedded system

I have a database file that is generated on a PC using Sqlite. This file is then transferred to an ARM7 based embedded system without an operating system. The embedded system must access this database, but does not need to update it. I have been trying to get sqlite3 small enough for the embedded system, but so far I cannot get the ap...

code igniter / cakephp and ms access

I'm trying to use Microsoft Access as the db for a demo project that I'm thinking of doing in either Code Igniter or CakePHP. Ignoring the possibly folly of using MS Access, I haven't been able to figure out precisely how the connection string corresponds to the frameworks' db settings. In straight php, I can use this code to connect to ...

Sanitizing Database Return Data

I am wondering what everyone thinks the best method of handling results from your own database is. Other teams may be involved and there is always the chance the procedure/data could be altered and erroneous results would occur. My question is this. Is it better to let and exception occur, catch and log it or try to handle all contingenc...

Multiple Indexes vs Multi-Column Indexes

I've just been adding an Index to a table in SQL Server 2005 and it got me thinking. What is the difference between creating 1 index and defining multiple columns over having 1 index per column you want to index. Are there certain reasons why one should be used over the other? For example Create NonClustered Index IX_IndexName On Tabl...

Bad Database Design - Is my table too large?

I have a poorly designed database. One of the most important tables has 11,000+ entries. We would like to expand our system, and I am wondering if this table grew to 5x its size, would this be a problem? It's 15360 kB in size... if that matters. I'm using phpMyAdmin, the server is a Fedora Linux box (nothing fancy), The load is light....

What is the proper size for a sequence-generated primary key?

Currently, primary keys in our system are 10 digits longs, just over the limit for Java Integers. I want to avoid any maintenance problems down the road caused by numeric overflow in these keys, but at the same time I do not want to sacrifice much system performance to store infinitely large numbers that I will never need. How do you ha...

Bulk Row Transfer between Oracle Databases with a Select Filter

Basically, I'm trying to selectively copy a table from one database to another. I have two different [Oracle] databases (e.g., running on different hosts) with the same schema. I'm interested in a efficient way to load Table A in DB1 with the result of running a select on Table A in DB2. I'm using JDBC, if that's relevant. ...

How can I copy a mySQL Database in ruby on rails?

We are making a Ruby On Rails webapp where every customer gets their own database. The database needs to be created after they fill out a form on our website. We have a template database that has all of the tables and columns that we need to copy. How can I do this in programatically from ruby on rails? ...