database

Java deque / prepared statement memory leak.

One of the following pieces of code generates a memory leak, any idea which part? 1) private Deque<Snapshot> snapshots = new LinkedList<Snapshot>(); Iterator<Snapshot> i = world.getSnapshots().descendingIterator(); while (i.hasNext()) { Snapshot s = i.next(); if (curTime - s.getTimestamp() > 60000) { i.remove(); ...

How to make tasks double-checked (the way how to store it in the DB)?

Hello all! I have a DB that stores different types of tasks and more items in different tables. In many of these tables (that their structure is different) I need a way to do it that the item has to be double-checked, meaning that the item can't be 'saved' (I mean of course it will be saved) before someone else goes in the program and c...

How to make a log on relational-data in SQL-Server?

Hello folks! I need to create in my DB a log, that every action in the program should be written there. I will also want to store additional data to it for example have the table and row the action was applied to. In other words I want the log to be dynamic and should be able to refer to the other tables in the database. The problem i...

database relationship to many tables and representation in entity framework

2 part question: 1st What is the best way to setup a table/relationship structure given the following scenario: I have many tables that store different kinds of data (ie: books, movies, magazine - each as different tables) and then one table that stores reviews that can link to any of the table types. So a row in the review table can ...

PHP, Python, Ruby application with multiple RDBMS

I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to. I firmly believe that using database abstraction layers for SQL generation is not the...

Generating a massive 150M-row MySQL table

I have a C program that mines a huge data source (20GB of raw text) and generates loads of INSERTs to execute on simple blank table (4 integer columns with 1 primary key). Setup as a MEMORY table, the entire task completes in 8 hours. After finishing, about 150 million rows exist in the table. Eight hours is a completely-decent number fo...

Easiest way to copy a MySQL database?

Does anyone know of an easy way to copy a database from one computer to a file, and then import it on another computer? ...

Add row in one table for every nth entry in another table

Basically what I have is a system where users get rewarded for every 10 comments. So, in the db, one table captures the comments, and the other a reward for every 10th comment added. For instance, if a user has added 40 comments, they will have 4 rewards/4 rows in table 2. It sounds so simple to me, but I can't seem to figure it. Though...

Django database scalability

Hi ALL: We have a new django powered project which have a potential heavy-traffic characteristic(means a heavy db interaction). So we need to consider the database scalability in advance. With some researches, the following questions are still not clear to us: coarse-grained: how to specify one db table(a django model) to a specific d...

How to use System.Web.Mvc.SelectListItem

How to use System.Web.Mvc.SelectListItem for asp.net mvc controller. ...

Connected to mysql instance ONCE or TWICE?

Hello there, I was wondering whether the following command (from a .bat script): (1) connects to the mysql instance once and then executes script#1 followed by script#2, or (2) does it reconnect for each of the sql scripts? mysql -B -b -h%HOST% -u%USER% -p%PASSWORD% %SCHEMA% < "scripts\create_and_populate.sql" < "scripts\update_joomla_...

How to prepare a django project for future changes

As I work on my first django powered site, I am constantly learning new things and making all sorts of changes and additions to my apps as I go. I try to follow DRY and pythonic principles and be smart in my coding but eventually I will have to take the site live and am certain that not long after I do, something new and exiting will co...

my insert query is working in my localhost but not in web server

hi, I am using flex builder 3 to insert into mysql database using php and everything is working perfectly in my localhost, the problem is when I deploy the project in the web server and run it, it connect to the database but i can't insert data ( it shows nothing when i insert data ) another stupid thing is in another piece of code for r...

Distributed Database Project

I am required to do a project for my distributed database systems course. This can be anything related to distributed database systems. Anyone have interesting ideas for a project? Ideally something sufficiently small in scope that I could start pounding on and eventually add as much as possible once I have something, because I only ha...

What Sql (PHPmyadmin)Statements would I use to create the following?

I want to create two Tables. Product, Members, and Category. I want the structure of the tables to be like: Category: Two Fields: (Category_ID) (Category_Name) and I would like Category_ID to be the Primary Key Product: Three Fields (Product_ID) (Product_Name) (Product_Price),(Category_ID) and I would like Product_ID to be the Primary ...

Doctrine PHP Question

I was wondering if you can specify the order in which table definitions and data fixtures are loaded using the CLI. My problem is that I have two tables, each having a foreign key constraint pointing to the other, so one of the constraints needs to be added after a record has been added. Or maybe there's a better way of doing this...I'm ...

How do I list all the available views of a particular table in SQLite ?

I want to access all the particular views of any particular table in Sqlite . I know I can get the list of all the available tables in the database using sqlite_master SELECT name from sqlite_master WHERE type='table'; And the list of all the available views using SELECT name from sqlite_master WHERE type ='view'; But I want to f...

CakePHP mathematic-calculation field?

(Database structure like http://stackoverflow.com/questions/1545764/cakephp-select-default-value-in-select-input) So, I have two tables in CakePHP: Trees, and Leafs. Every Leaf has a tree_id for its corresponding tree. Every leaf also has a numeric value. The default view that I baked for trees just lists all the trees in a table. I...

we implement connection pooling ourselves, but why it always out of connection ?

Following is the source code: //public class ConnectionPool implements Runnable public class ConnectionPool { private static Logger loger_error = Logger.getLogger("error"); // JDBC Driver name String driverName; // JDBC Connection URL String connectionURL; // Minimum size of the pool int connectionPoolSize;...

Capistrano Deploy Wipes Database?

I've managed to deploy my app to production using Capistrano, but I don't understand how to deal with my database. I'm using subversion and passenger. When I run cap deploy, the new deployment starts everything fresh. It wipes out the data that was added to the database. Obviously, there must be a solution, but I'm very surprised not...