database

How to determine whether a database has been changed or not ?

I have a need to determine if a database on a MS SQL Server has changed between two distinct moments. The change can be structural or data-related and the check should be generic (i.e. independant of the structure of the database). Preferably, I'd like the check to be T-SQL based or with SMOs, not file based. I checked on MSDN but I hav...

The Efficient way to sort a collection of Objects

Hi, I have a requirement to sort a collection of objects, They are shown on a web page in tabular format. My sorted collection is created like TreeSet<MyObject> objs= new TreeSet<MyObject>(); Currently MyObject is implementing Comparable interface to provide sorting. In the compareTo method object is checked against the date of cre...

How to store data of java array in Hard Disk, so as i can use it later?

Goodevening Sir/Mam, I am trying to make a small program that will be used for hotel room reservation, please tell me how to store the data of room's status on disk, as when we open the program next time we'll get the data. Please help i am very new here. Have a nice day! ...

How to get identities of inserted data records using SQL bulk copy

I have an ADO.NET DataTable with about 100,000 records. In this table there is a column xyID which has no values in it, because the column is an auto-generated IDENTITY in my SQL Server database. I need to retrieve the generated IDs for other processes. I am looking for a way to bulk copy this DataTable into the SQL Server database, an...

Many to Many Association Tables - Is it customary to put additional columns in these tables?

We've encountered the following situation in our database. We have table 'A' and table 'B' which have a M2M relationship. The association table is named 'AB' and contains a FK column to table 'A' and a FK column to table 'B'. Now we've identified a need to store additional data about this association. For example, a date when the associa...

Looking for documentation for writing database-related unit tests in .Net.

Hi, I have heard that MbUnit comes with pretty nice test decorators which allow writing db-related tests with ease. I am struggling to find good documentation with samples. Also, can the same thing be achieved with the latest Micosoft's Test package? Many thanks. ...

database design tool question

is there a good database design tool can generate sql script to create database (tables) in major database (Oracle, MySQL, SQL server, Sybase) without any changes? Which design tool are you think is good. ...

Object reference not set to an instance of an object Error

I'm trying to save text fields in MySql using NHibernate in Asp.Net frame work. But while executing this I got the error"Object reference not set to an instance of an object". If anyone knew help me... Here is the code. if (!Page.IsPostBack) { IList siteList; ISessionFactory factory = new NHibernate.Cfg.Configuration().Configur...

Difference between dates when grouping in SQL

I have a table of purchases containing a user_id and a date_of_purchase. I need to be able to select all the users who have made 2 purchases within 12 months of each other. The dates can be any point in time as long as they are less than 12 months apart. e.g. user_id date_of_purchase 123 01/Jan/2010 124 01/Aug/...

Database: initialization script vs. failsafe code (a.k.a. ALWAYS UPDATE vs. INSERT OR UPDATE)

I was wondering... when working with a fixed set of data (say: the population of some cities in a database table CITY_NAME, CITY_POPULATION) that is subject to change which is the best practice? use an initialization script to populate the table with all possible records and write code to only update the number of citizens for a given ...

How to find foreign-key dependencies pointing to one record in Oracle?

Hi folks, I have a very large Oracle database, with many many tables and millions of rows. I need to delete one of them, but want to make sure that dropping it will not break any other dependent rows that point to it as a foreign key record. Is there a way to get a list of all the other records, or at least table schemas, that point to ...

ASP.net application advice needed

hey all, im biulding a ASP.net application, which is connected to a database. the database design is as follows **Users Table** UserID `(PK) autonumber` Username **Question Table** QuestionID `(PK) autonumber` QuestionNumber QuestionText **Questionnaire Table** QuestionnaireID `(PK) autonumber` UserID `(FK) User Table` Date **Feed...

postgresql: foreign key to either tableA or tableB

I'm trying to figure out how to define the schema of a database on with Postgresql 8. I have 2 tables: Journals, Books that define the publications I have Journal: id_j, name, issn, other fields Book: id_b, name, isbn, author, other fields and I have another table Scans that logically refers both the previous tables. Scans: id, m...

Troubleshooting PG Function

I have this function: CREATE OR REPLACE FUNCTION CREATE_AIRSPACE_AVAILABILITY_RECORD (cur_user VARCHAR, start_time VARCHAR, start_date VARCHAR, end_time VARCHAR, end_date VARCHAR, airspace_name VARCHAR) RETURNS VOID AS ' DECLARE c_user ALIAS for $1; BEGIN IF start_time IS NULL OR start_date IS NULL OR end_time IS N...

maintaining a large list in python

I need to maintain a large list of python pickleable objects. The list is too large to be all stored in the RAM, so some database\paging mechanism is required. I need that the mechanism will support fast access for close (nearby) areas in the list. The list should implement all the python-list features, but most of the time I will work ...

Combining cache methods - memcache/disk based

Hi! Here's the deal. We would have taken the complete static html road to solve performance issues, but since the site will be partially dynamic, this won't work out for us. What we have thought of instead is using memcache + eAccelerator to speed up PHP and take care of caching for the most used data. Here's our two approaches that w...

What's the best django way to do a query that spans several tables?

I have a reviews/ratings web application, a la Digg. My django app content has the following model: class Content(models.Model): title = models.CharField(max_length=128) url = models.URLField(max_length=2048) description = models.TextField(blank=True) class Recommendation(models.Model): user = models.ForeignKey(User) ...

Calculate weight for entries and order it for search

Hello I have these tables: businesses :name :rating categories :name business_categories :business_id :category_id reviews content business_id Now I want to do a search, when type keywords, match it in these columns: business.name business.category.name business.review.content Then order the results by the weight,...

Should searchable date fields in a database table always be indexed?

If I have a field in a table of some date type and I know that I will always be searching it using comparisons like between, > or < and never = could there be a good reason not to add an index for it? ...

Convert BLOB to Jpg using C#

Hello, I am currently developing a web application that receives data from an on-site database. The database developers have developed some web-services that I am able to call and send/receive data to and from the the database. When I want to display an image the method returns the image in BLOB format. My question is: what is the best...