database

IntegrityError: foreign key violation upon delete

I have Order and Shipment model. Shipment has a foreign key to Order. class Order(...): ... class Shipment() order = m.ForeignKey('Order') ... Now in one of my views I want do delete order object along with all related objects. So I invoke order.delete(). I have Django 1.0.4, PostgreSQL 8.4 and I use transaction middleware...

Android: database reading problem throws exception

Hi, i am having this problem with the android database. I adopted the DBAdapter file the NotepadAdv3 example from the google android page. DBAdapter.java public class DBAdapter { private static final String TAG = "DBAdapter"; private static final String DATABASE_NAME = "PasswordDb"; private static final String DATABASE_TABLE = "myuse...

How do I write this MySQL Query? (datetime)

Suppose I have a DateTime field called "time_before" I want to insert a datetime that is 1 hour before the now() time. INSERT INTO mytable(time_before) VALUES(now()-3600 seconds)...something like this, right? ...

OpenOffice Base update fields in form

Hi I have a simple question I just cant figure out. In OpenOffice Base I try to make a form where it is possible to enter an order. When you enter a customer id. I have 2 textboxes there should be updated with information about the customer name and a description about the customer. How does I get these 2 textboxes to update? at the ...

How do you handle descriptive database table names and their effect on foreign key names?

Hello, I am working on a database schema, and am trying to make some decisions about table names. I like at least somewhat descriptive names, but then when I use suggested foreign key naming conventions, the result seems to get ridiculous. Consider this example: Suppose I have table session_subject_mark_item_info And it has a forei...

Synchronising tables across remote Access databases

Hi folks, I'm helping out a business by providing an Access DB to manage requests of various types. As they are a construction company, they have one machine in an 'office' on the building site, plus 3 based in their main office. The machine on site has no internet connectivity. Is there any (reasonably simple) way to synchronise the o...

Metadata requirements for developers

I'm tasked with providing a list of metadata requirements our data warehouse developers might need. This is not the business metadata (nice descriptions etc), but rather data required for change management (also known as impact assesment), data lineage etc. I've seen this article Meta Meta Data Data - Ralph Kimball but as I'm not the f...

When are ENUMS joined in in PostgreSQL

If I run a select from a column in PostgreSQL that is of type enum, are the string values of the enum joined in before or after the final result set has been created? An explanation of my motive can be found at http://archives.postgresql.org/pgsql-performance/2008-07/msg00226.php ...

Buffer Overrun using Mysql Connector c++

Hi all, I'm having a few issues executing sql statements in c++ using the connector. Any hints or ideas are welcome. NB: Mysql Connector c++ 1.05 I have these defined in the class header: sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::ResultSet *res; sql::PreparedStatement *prep_stmt; And the...

Should foreign keys become table primary key?

Hello again, I have a table (session_comments) with the following fields structure: student_id (foreign key to students table) session_id (foreign key to sessions table) session_subject_ID (foreign key to session_subjects table) user_id (foreign key to users table) comment_date_time comment Now, the combination of student_id, session...

Modeling a Generic Relationship (expressed in C#) in a Database

This is most likely one for all you sexy DBAs out there: How would I effieciently model a relational database whereby I have a field in an "Event" table which defines a "SportType"? This "SportsType" field can hold a link to different sports tables E.g. "FootballEvent", "RubgyEvent", "CricketEvent" and "F1 Event". Each of these Sp...

How can I synchronize one set of data with another?

I have an old database and a new database. The old records were converted to the new database recently. All our old applications continue to point to the old database, but the new applications point to the new database. Currently the old database is the only one being updated, so throughout the day the new database becomes out of sync...

Change an access Primary key with relationships

I have a database in access 2007 accdb extension , there are more or less 30-40 tables with related primary key "local_number". it is a text primary key with 10 lenght. How can I change the length of this primary key to 30 WITHOUT delete previosly all the 30 relationship. A similar question. I need add a compose primary key to my PK ...

High performance querying - Suggestions please

Supposing that I have millions of user profiles, with hundreds of fields (name, gender, preferred pet and so on...). You want to make searches on profiles. Ex.:All profiles that has age between x and y, loves butterflies, hates chocolate.... With database would you choose? Suppose that You have a Facebook like load. Speed is a must....

Proper abstraction of the database tier in a 3 tier system?

Hello, I am creating a 3 tier application. Basically it goes Client -> (through optional server to be a thin-client) -> Business Logic -> Database Layer And basically making it so that there is never any skipping around. As such, I want for all of the SQL queries and such to be in the Database Layer. Well, now I'm a bit confu...

Why isn't "String or Binary data would be truncated" a more descriptive error?

To start: I understand what this error means - I'm not attempting to resolve an instance of it. This error is notoriously difficult to troubleshoot, because if you get it inserting a million rows into a table 100 columns wide, there's virtually no way to determine what column of what row is causing the error - you have to modify your pr...

Does a char occupy 1 byte in a database?

Does a char occupy 1 byte in a database? EDIT: If I define a column as varchar(1), will it reserve 1 or 2 bytes for me? ...

GUID type in database

GUID is not an official data type in database. In our existing SQL Server design, the Uniqueidentifier type is used for GUID value. Now we are switching to Sybase database. Should we use varchar(36) to replace that Uniqueidentifier type? I am still confused by GUID. I was told GUID is 16 bytes long but its character string is 36 charact...

Auto Reconnect of Database Connection

I have a DBCP connection pool in Tomcat. The problem is that when the connection is lost briefly the appliction is broken because DBCP won't try to reconnect again later when there is a connection. Can I get DBCP to reconnect automatically? ...

In Python, after I INSERT Into mysqldb, how do I get the "id"?

The primary key. cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height)) My table has 2 columns: id << primary, auto increment height << this is the other column. How do I get the "id", after I just inserted this? ...