database

Hibernate Session Connection Relationship

How many connection will hold for a single hibernate session where there is only one DB? ...

JOIN three tables

I am trying to retrieve two sets of information (the red and blue portions of the diagram in the one query. I thought I could do it using the sql as stated below but it does not return me anything when TableC has no records. If TableC has no records, I would still want this query to return me the results as indicated by the BLUE area. ...

Serialize/deserialize DataSet (as a way to backup my data)

Hi all, I have written the contents of a table in my database to the disk using the following function. private static Stream GetTableAsBinary(string table, OleDbConnection oleDbConnection) { var oleDbDataAdapter = new OleDbDataAdapter(string.Format("select * from {0}", table), oleDbConnection); var dataSet = new DataSet(); ...

AJAX Chat, implement server with DB or as a windows service?

I am implementing an AJAX chat. No worries there but I was thinking of how to implement the server side code. At the moment I write from a DB when a user sends and reads from the DB when a user requests his messages. I am thinking that this is not the most efficient way as I am writing and reading all the time. My plan was to implement...

Database design for items that have restricted shipping regions

I am designing the database for a shopping cart and I am having trouble deciding which way to approach this problem. There are three tiers that can items can be restricted to: 1) Local Delivery Only 2) Shipping Available a) Country b) State c) Region I am thinking to go with a structure like this: product_shipping_res...

how to use database in android?

I am new to mobile application development.I wish to know how to create and use the database in android. Is there any requirements needed to create the database(like sql)? now i use the eclipse ide. ...

How to get Result from database by order the condition put in "IN" clause?

Sorry for bad english. bfproduct is a table and productid is primary key in this table and productname is another field defined in this table. When i execute this query, select * from bfproduct where productid in (23,5,54,3132,32). The result is as follows: productid | productname 5 15 Park Avenue 23 Good Boy Bad Bo...

Sql Excution Plan Shows Different result for same inputs

declare @name varchar(156) set @name ='sara' --Query 1: SELECT [PNAME] FROM [tbltest] where [PNAME] like '%'+@name+'%' --Query 2: SELECT [PNAME] FROM [tbltest] where [PNAME] like '%sara%' suppose that there is a NoneClustered Index on [PNAME] column of [tbltest]. when running Queries, Excution plan show index Seek For Query 1 an...

searching data in a database

Hi, Here is the aspx.cs file for my web application: protected void Button1_Click(object sender, EventArgs e) { SqlDataReader myDataReader = null; string connectionString = "Data Source=[my source];Initial Catalog=[catalog name];Integrated Security=True"; using (SqlConnection connection = new SqlConnection(con...

Seeking Embedded Database alternative to SQLite. Must have foreign key contraint and transaction support?

Do you know of any SQLite alternatives (Portable/flatfile based/serverless) that have foreign key constraint and/or offer transaction support? ...

"Parametrized" database model & backend storage system as well as data mining manipulation

Hi Guys I have implicitly made this a community wiki seeing that the answers can be quite broad. I'm working with a start-up company to accomplish the following goal. In a medical research, a patient medical record can have infinite amount of data regarding a patient for a specific diagnosis, e.g. a smoker has a higher chance of catchi...

Rails 2 :joins and :include resultset

When fetching content from a database using activerecord, I would like to fetch a custom resultset with specified columns across two tables. SELECT users.name, users.username, users.age, users.city_id, cities.name as city_name FROM users INNER JOIN cities ON users.city_id = cities.id Which would be in AR as Users.find(:all, :join...

multiple users, multiple applications, one server

I have an idea for a web application that involves a multiple users, two different applications (which will be run from a user's local machine), and a remote database server. Databases stored on remote server: 1) Username database - contains user information 2) application database - contains two rows, one for each application. Stores a...

need help with my database design

I really really cant get my head around this, i've thought about this for ages but the penny wont drop. I have just started learning php and sql so for all i know its probably really simple. I want to create a football application with leagues, fixtures, and results for a pc football game that a group of us in college play. The idea is t...

Fact and/or generic knowledge storage

How can generic facts be stored in a database such as '3 injured in Kansas fire' or 'Spain wins 2010 Worldcup'? The end result would be to have some table(s) where if multiple entries for people being injured or multiple entries for sports scores - data could be queried/totaled. desired query would be to see how many injuries have oc...

ActiveRecord Table Aliases

Does anyone know if it's somehow possible to setup an alias for an ActiveRecord table join? Something like: User.find(:all, :alias => "Users as u", :joins => "Friends as f", :select => "u.id,f.name") Any ideas? ...

How to transfer data from database to and from XML

I like to use xml as interchange format between different databases. The xml format is standardized (xsd) and also the database schema is pretty fix. My tasks now is to map between those worlds. Is there a kind of "mapper" to transform xml to sql databases in a bidirectional manner? I like something similar to the mapping files used in...

Syncrhonizing 2 database with different schemas

Hi guys, We have a normalized SQL Server 2008 database designed using generic tables. So, instead of having a separate table for each entity (e.g. Products, Orders, OrderItems, etc), we have generic tables (Entities, Instances, Relationships, Attributes, etc). We have decided to have a separate denormalized database for quick retrieva...

High Availability Active-Active Database Design

Hi, I am trying to design a HA solution for an active-active site. Basically, Site A and Site B are both writing to the same table in a database that is position outside of Site A and B. This database is use in an event when either Site A or B fails, it could be use as a backed up. MySQL is being used here. So i am wondering is there a...

CakePHP update field value based on other value in same row?

I have been trying to figure out how to do this and it seems that its not something that many people are trying to do in cakephp or I am just completely misunderstanding the documentation.. I am using the following query below to get a field value so I get a value where the "findbycreated" is 0... this part works fine $unregisteredemail...