database

Invalid Argument to getUInt64 when retrieving LAST_INSERT_ID()

I have added a record to my table which auto-increments the primary key. I am having no luck retrieving this new value. The MySQL documents say to use the SELECT LAST_INSERT_ID(); in a query. I have done this, but can't retrieve the results. According the the metadata of the result set, the data type is BIGINT and the column name i...

What is postgresql_psycopg2 ?

What is postgresql_psycopg2 ? Difference from postgresql ? ...

Database Design for One to One relationships

I'm trying to finalize my design of the data model for my project, and am having difficulty figuring out which way to go with it. I have a table of users, and an undetermined number of attributes that apply to that user. The attributes are in almost every case optional, so null values are allowed. Each of these attributes are one to o...

Rails log shows unexpected data as to the time spent on a DB stuff

I'm running on WinXP + Ruby 1.8.6 + Rails 2.3.5 (frozen to the project) in development environment. Looking at development.log I observe inconsistent data as to the time spent on a database stuff. Example #1 (good): Processing PagesController#index (for 127.0.0.1 at 2010-05-11 12:15:54) [GET] Parameters: {"action"=>"index", "controlle...

How do you keep the order using SELECT WHERE IN()?

Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query: SELECT id FROM data_table WHERE id IN(56,55,54,1,7); The results will come back using the default order by id. 1,7,54,55,56 When I want to keep the order used in the IN: 56,55,54,1,7 Is there a quick way to do this in mySQL or will...

Still Confused About Identifying vs. Non-Identifying Relationships

So, I've been reading up on identifying vs. non-identifying relationships in my database design, and a number of the answers on SO seem contradicting to me. Here are the two questions I am looking at: What's the Difference Between Identifying and Non-Identifying Relationships Trouble Deciding on Identifying or Non-Identifying Relation...

What is the difference between the different BerkeleyDB versions, and which should I choose?

Many things depend on BDB. When I go to install the prepackaged software for my server, each piece of software seems to want a different version of BerkeleyDB. But it seems when I compile them I can specify a specific BDB version. (The software involved includes Postfix, OpenLDAP, and Cyrus IMAP.) I use BDB in python projects occaisio...

Select all points in a matrix within 30m of another point

So if you look at my other posts, it's no surprise I'm building a robot that can collect data in a forest, and stick it on a map. We have algorithms that can detect tree centers and trunk diameters and can stick them on a cartesian XY plane. We're planning to use certain 'key' trees as natural landmarks for localizing the robot, using ...

Java DAO caching

I'm developing a medium Java app, and i'm facing a small problem due to my lack of experience. I've a custom DAO, which gets "Article" objects from the Database. I've the Article class, and the DAO has a method called getArticle(int id), this method returns an Article. The Article has a Category object, and I'm using lazy loading. So, ...

Facebook Privacy Permissions Design

Does anyone know the general layout of how facebook's privacy permissions system works (database)? I've been trying to figure out how they manage to have such a complex set of rules be applied to various content on their site, yet it remains fast. How are they doing that? ...

updating changes from one database to another database in the same server

I have a copy of client database say 'DBCopy' which already contains modified data. The copy of the client database (DBCopy) is attached to the SQL Server where the Central Database (DBCentral) exists. Then I want to update whatever changes already present in DBCopy to DBCentral. Both DBCopy and DBCentral have same schema. How can i do ...

How to insert/update multiple record into SQLite database in a single query.

Hi Guy. Is it possible to insert/update multiple record in SQLite database using EGODatabase wrapper. If I'm correct I think we can do it with FMDatabase by wrapping it between [db beginTransaction] and [db commit]. I wonder if we can do the same thing by using EGODatabase. Following is the code sample from FMDatabase project: [db be...

Update database every 30 minutes once

Hi, I am working on C#.Net Windows application with SQL Server 2005. This project i am using ADO.Net Data-service for database maintenance. I am working on industrial automation domain, here data keep on reading more than 8 hours. After reading data from device based on the trigger i have periodically update data to database. for exampl...

SQL Complicated Group / Join by Category

I currently have a database structure with two important tables. 1) Food Types (Fruit, Vegetables, Meat) 2) Specific Foods (Apple, Oranges, Carrots, Lettuce, Steak, Pork) I am currently trying to build a SQL statement such that I can have the following. Fruit < Apple, Orange Vegetables < Carrots, Lettuce Meat < Steak, Port I have ...

C# Find out what column caused the Sql Exception

Hi. I'm getting an exception from SQL Data Reader (MS SQL as datastore) and I'd like to know which column name causes this Exception to be thrown. But I cannot find it in the InnerException.. nowhere. ((System.InvalidOperationException)ex.InnerException).StackTrace: System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i) System.D...

Encrypt hashed passwords?

Hi everyone, Is it common sense to encrypt hashed&salted passwords that are stored in a database with a strong encryption (AES 192 or so) or are we just aiming for the stars? Of course, the encryption key will not be in the database itself, but will be kept at a safe place. Thanks a lot! ...

NHibernate, each property is filled with a different select statement

I'm retrieving a list of nhibernate entites which have relationships to other tables/entities. I've noticed instead of NHibernate performing JOINS and populating the properties, it retrieves the entity and then calls a select for each property. For example if a user can have many roles and I retrieve a user from the DB, Nhibernate retrie...

How to create SSIS package to update from one database to another database within same server

My query is related to the answers i got for questions i had posted earlier in the same forum. I have a copy of a client database which is attached to SQL Server where the Central Database exists. The copy already contains the updated data. I just want to transfer the updates from that copy to Central Database both holding same schema an...

Can we define a nonclustered index without defining the clustered index?

Can we define a nonclustered index without defining the clustered index on a table? ...

What file format should I use for my application?

I'm writing an application that manages todo lists. Unlike 'traditional' todo list applications I want users to have these todo list files sit on their filesystem and be visible instead of being magically hidden by the app. I want users to be able to email todo lists to each other and so on. In addition, I later intend to create a web ap...