database

Deleting application database from emulator

I'm testing an application I'm working on and I wanted to delete the database my application creates so I could read all the data from my web server back in to a fresh one. I launched adb, went to data/data/my.applicaton.package/databases and did a "rm mydatabase". This deleted the database (note: I've done this many many times before ...

Complex SQL Subquery to LINQ

I have this SQL query that is just impossible to get going in LINQ. select * from attribute_value t0 where t0.attribute_value_id in ( select t1.attribute_value_id from product_attribute_value t1 where t1.product_attribute_id in ( select t2.product_attribute_id from product_attribute t2 where t2.product_id in...

When NOT to use NoSQL?

There was an article on Hacker News a couple of days ago that reached first page titled something like "2 cases when not to use Mongodb" but I really can't find it anymore... Does anyone know where I can find the above described article? What cases are there when NoSQL fails? ...

Attach additional ObjectSets to ObjectContext from separate project

Hi, I hope this makes sense. I have a ASP.NET web application that uses Entity Framework. I have added a couple of custom tables to the db and created a separate project to handle the CRUD operations for those tables. I chose the separate project because I don't want future upgrades to the application to overwrite my custom features. ...

Trying to group similar text rows in a column of a million row table - Open to Non-MySQL approaches

I have a large number (about 40 million) of VARCHAR entries in a MySQL table. The length of the string can be anywhere between 5-80 characters. I am trying to group similar text together and thought of a possible approach: Take a row and calculate a similarity measure (like Edit Distance) with every other row and decide (I am not sure h...

Avoid huge intermediate query join result (1.33615E+35 rows)

I need a query to prevent a join that produces 1.34218E+35 results! I have a table item (approx 8k items; e.g. Shield of Foo, Weapon of Bar), and each item is one of 9 different item_type (Armor, Weapon, etc). Each item has multiple entries in item_attribute (e.g. Damage, Defense). Here is a pseudo-code representation: Table item ( it...

Checking the identity of a new table for database unit tests

I have a suite of database unit tests that were created. In order to replicate all of the tests on any machine I deploy out to there are scripts to drop the database and recreate it. The test will work for all of the unit tests except for the first test. The reason the first test fails is that I am executing the "dbcc checkident" comma...

Where can I find a good jdbc-odbc bridge driver?

I do data conversions, and I am constantly connecting to a variety of different DBMS'. Certain DBMS' do not have JDBC drivers (MsAccess for example). Sun's JDBC-ODBC bridge driver was meant as a short term solution when JDBC drivers weren't widely available, and because of that, it is lacking functionality and is pretty buggy. I am to...

PHP/MySQL checking for duplicate content in database

Im loading an xml file with tweets and then adding it a to a Mysql database. Up to this point it works fine but id like to do a basic check on the url field to see if its already added in the database. If its in the database already id like to update the mention count else insert it as a new entry. Its a real newbie question but im strug...

like stackoverflow questions tags,how to design it in databases?

i has 3 plans: 1, in questions table: question ------------------------------------ id title content ... tags ------------------------------------ 1 aaa bbb ... tag1,tag2,tag3 (use , to split more tags) 2, in tags table and split: tags ------------------------------------ id tag --------------------------...

Lightweight method to cache some text with LAMP

I have a symfony website running on the standard LAMP setup. I need to store about 400 bytes (the result of a JSON query, actually). the result for this query fails often (out of my hands). I want to cache this somehow. what is the easiest, cleanest, lightest way to do this? I have a MySQL database that's being used by my models, so I ...

Transfer associated data to another DB

Hi, i need to transfer data from one SQlite3 database to another, preserving all the associated records. For example, Person has many messages, each message has many attachments. I need to transfer, say only "Person1" and "Person2" with all messages, belonging to them and with all attachments, belonging to each message. I've heard ab...

Database Access

Hi all, I want code about how to access table values from more than one database in SQL and how we display that values? ...

Database concurrent connections in regard to web (http) requests and scalability

One database connection is equal to one web request (in case, of course, your client reads the database on each request). By using a connection pool these connections are pre-created, but they are still used one-per-request. Now to some numbers - if you google for "Tomcat concurrent connections" or "Apache concurrent connections", you'l...

How to store bidirectional relationships

I am writing some code to find duplicate customer details in a database. I'll be using Levenshtein distance. However, I am not sure how to store the relationships. I use databases all the time but have never come accross this situation and wondered if someone could point me in the right direction. What confuses me is how to store the...

Clustered indexes on non-identity columns to speed up bulk inserts?

My two questions are: Can I use clustered indexes to speed up bulk inserts in big tables? Can I then still efficiently use foreign key relationships if my IDENTITY column is not the clustered index anymore? To elaborate, I have a database with a couple of very big (between 100-1000 mln rows) tables containing company data. Typically ...

T-SQL. Still need an identity value from SuperType table although there are no values to insert

Hello. Rightly or wrongly I’m dealing with a generalised SuperType table which I have the sub type data for but not the SuperType data. However to insert the SubType data I obviously need the Identity ID from the SuperType table first. I was wondering if anyone else has come across this and how they got around it. Unfortunately there...

Creating dynamic database structure with CouchDB?

I'm new to CouchDB and want to give it a try. But before I do that I want to know if I can create dynamic database structure in CouchDB. Eg. The user starts on a blank thread and chooses whatever structure he/she wants (eg. title, body and tags and fill them in) When he clicks save thread the database for this is created, maybe nested...

How to know when Solr Optimize is done?

I am using the Solr-php-client to communicate with Solr, via php. This piece of code triggers the solr optimize command: $solr->optimize(); I wonder if there is any method to know for sure that the optimization is done? This is all because I have an administrations page on my website where I manually once a day must optimize the S...

is it possible to explicity insert values in timestamp column of DB2

Hi, is it possible to explicity insert values in timestamp column of DB2? For example i have a date time value '2\11\2005 4:59:36 PM'. How to convert it to timestamp value in DB2? Thanks in advance ...