database

Query if Adroid DB exists!

Hello all, I have created a database for my android app which contains static data and does not require update/delete functionality thus when the app starts, I want to check if the db exists and if not then execute my dbAdapter class. I know its a simple if statement but I was just wondering the most efficient way to query whether the d...

Best practices: working with DB in Java

Hello! First of all, I'm new to Java. I'm trying to figure out what would be a good/handy way to work with DB from Java. I'm using c3p0 for connection pooling. Hibernate or other ORM is not an option this time, we decided to stick with "plain SQL" for now. Currently basic retrieval of data looks like this: private int getUserID(int s...

PDO select query error

I am trying to run this simple SELECT query using PDO::MySQL, but it does not return a value, as you can see from the dump $row returns false, which means there was an error. The database connection works, as I'm writing to the database a few lines further down Sql query is correct Can someone see the bug in this code? If you can I'd ...

Wordpress Database with custom table

I am trying to pull data from a table I have imported into my wordpress database. My php code works for all the default wp_ tables but when try and target the tables I actually want I get bugger all back. My code (currently echoing all post titles and it works) $liveposts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->posts...

How to show user specific features when they are logged in?

I am trying to write code for a site for my consulting practice. I know how to have a database and how to manage users on the site. But now I want to charge users for custom features they want me to build from ground up. (e.g they want an option to upload pictures or ability to get certain reports via 3rd party API, which for purposes...

advantage of db session?

Hi, while I was installing Magento, I saw db storage option. There were 'file system' and 'db'. What is advantage of saving sessions in DB? I can't think of one. ...

NoSQL / RDBMS hybrid?

Is there a database out there that gives you the benefit of referential integrity and being able to use a SQL type language for querying, but also lets entities be loosely defined with respect to their data attributes and also the relationships between them? E.g. take a RBAC type model where you have Permissions, Users, User Groups & Ro...

Recommended pattern for domain entities containing data from multiple databases.

Hi all I maintain an application which has many domain entities that draw data from more than one database. The way this normally works is that the entities are loaded from Database A (in which most of their fields are stored). when a property corresponding to data in Database B is called, the entity fires off SQL to Database B to get a...

Avoid race conditions in eCommerce scenarios

Hello, My client has a ecommerce website that sells electronics, and there has been situations where a product is sold more times than they have in their inventory. This is because if two users buy a product at the same time when there is only one product left in stock, one session does not finish registering the product as sold out bef...

How to specify multiple restriction values in DbConnection.GetSchema

MSDN documenation for DbConnection.GetDBSchema says - Returns schema information for the data source of this DbConnection using the specified string for the schema name and the specified string array for the restriction values. Regarding the restriction values The restrictionValues parameter can supply n depth of values, whi...

Social Objects - best practices for database structure, filtering, sorting, extensibility

We're in the process of building a generic enterprise social networking platform in ASP.NET MVC. One of the key features of any social networking website are the social objects that are posted by users either explicitly (text updates, photos, blogs, videos etc) or implicitly ('user is attending event', 'user has updated page' etc). The...

How can I calculate successive elements in a database using Rails?

Is there a way I can query the database to return only the elements that have happened successively (in time) according to a set variable? Specifically, I need to find out how many times the user has won a game in a row. The games are stored in the database with an attribute win_loss (1 is win, 0 is loss). I would like to see if the u...

Database Access in Android

I am creating an android app that is basically a listing of information on Mushrooms. I get this information from an sqlite database. I have a global singleton with a services class inside it in which I use to access my db. Almost every activity accesses the db. Is it better to leave my db open all the time or open and close it as I ...

Best way to store hierarchical file structure in Rails

In my rails app, a user can have multiple directories which have further files and subdirectories, just like Dropbox. The only difference is Dropbox has user files both on the cloud and the client PC as well, whereas I want to store the entire directory on the cloud. How should i do it?? ...

What is Extract/Transform/Load (ETL)?

I've tried reading the Wikipedia article for "extract, transform, load", but that just leaves me more confused... Can someone explain what ETL is, and how it is actually done? ...

SQL - How to transpose?

I have something similar to the following table: ================================================ | Id | UserId | FieldName | FieldValue | =====+========+===============+================| | 1 | 100 | Username | John Doe | |----+--------+---------------+----------------| | 2 | 100 | Password | pass123! ...

Dot Net Nuke Installation

I am new to Dot Net Nuke. I downloaded and tried to install it onto Windows Server 2008. It installs to the point where it starts running scripts for the database. I choose SQL Server 2005/2008 as the database and put in the correct Database name and connection string with the correct credentials as well. It however fails after running a...

Optimize a 4 table related oracle query

Hi al, I need to optimize the following query but 'm not able to wonder how. select distinct v.codvia, v.codproine, v.codmunine, tv.SIMBOLO as SIMBOLO_TIPO_VIA, tv.NOMBRE as TIPO_VIA, c.nombrevia as NOMBRE_VIA, v.cp, m.nombre as NOMBRE_MUNICIPIO , pr.nombre as NOMBRE_PROVINCIA from tdinumvias v, ...

architecthure for a large data driven website

I know how to create small data driven websites but want to get an idea on how to convert them to handle large data flow. The questions are based on a site that would act mostly like stack overflow, craigslist etc where people could post stuff and others reply and would have basic search capabilities based on tags. Are regular relatio...

Best way to manage Rails application configuration settings persisted in a database?

Hello, I was hoping someone could suggest some best practices for configuring Rails applications using a database (i.e. persisting configuration settings to a database rather than a flat file). My reasoning for this is that I have an application that will run on multiple servers and there are some configuration settings that are fairly ...