0
голосов
2ответов
280 просмотров

Foreign key needs a value from the key's table to match a column in another table

Pardon the excessive amount of code, but I'm not sure if I can explain my question otherwise I have a Django project that I am working on which has the following: class Project(models.Model): name = models.CharField(max_length=100, unique=True) dir = models.CharField(max_length=300, bl...

98
голосов
6ответов
210076 просмотров

SQL Server Script to create a new user

I want to write a script to create a admin user ( with abcd password ) in SQL Server Express. Also I want to assign this user admin full rights.

11
голосов
5ответов
18953 просмотров

Implementing result paging in hibernate (getting total number of rows)

How do I implement paging in Hibernate? The Query objects has methods called setMaxResults and setFirstResult which are certainly helpful. But where can I get the total number of results, so that I can show link to last page of results, and print things such as results 200 to 250 of xxx?

3
голосов
1ответов
1431 просмотров

How do I have multiple schemas per database connection in Eclipse DTP?

I'm using the Eclipse DTP to do my SQL development. When I create a database connection I'm promoted to enter the name of the database (schema), and I cannot continue until I enter it. However, I have several databases on each server, and I want to see them all under the database connection (like...

1
голосов
2ответов
69 просмотров

Activity list ala SO

We are building a set of features for our application. One of which is a list of recent user activities ala on SO. I'm having a little problem finding the best way to design the table for these activities. Currently we have an Activities table with the following columns UserId (Id of the user ...

38
голосов
3ответов
28183 просмотров

How to implement Active Record inheritance in Ruby on Rails?

How to implement inheritance with active records? For example, I want a class Animal, class Dog, and class Cat. How would the model and the database table mapping be?

0
голосов
2ответов
3990 просмотров

Android Database error?

I have a MenuItem in my Android application that deletes all the values in the database, its used more for my debugging purposes, after a while, inserting dummy values get redundant. Anyways, I have used LogCat to debug my program as it runs in the emulator and it gives me an error: Failure 21 (...

3
голосов
2ответов
476 просмотров

Suggested indices for a MPTT table

I'm just building a table to store hierarchical data using the Modified Pre-order Tree Traversal (MPTT) -- you know the one: each node stores the left and right IDs to find its descendants. I'm using a the CakePHP suggested model, which varies from the standard way by including the parent_id with...

0
голосов
3ответов
3603 просмотров

Deleting Objects with JPA with Foreign Key Constraints

I have a two classes, Service and Customer, with a many-to-one association from Service to Customer. I want to delete a Customer and any Service that references it. I'm using JPA as the ORM (with Hibernate underneath) attached to a PostgreSQL db. It'd be great if I could define the association i...

4
голосов
3ответов
2203 просмотров

Why is this MySQL UPDATE taking forever?

I'm trying to figure out why one of our migration scripts is taking forever we are trying to do an update that joins from another table to get a relevant piece of data. Each table (A, B) has about 100,000 rows. # now populate the ACHIEVEMENT_INSTANCE.OBJECTIVE_INSTANCE_ID update A a, B b set a....

3
голосов
5ответов
3380 просмотров

Do I have to explicitly disconnect from a database when using Java?

It is necessary to disconnect from the database after the job is done in Java? If it is not disconnected, will it lead to memory leaks?

0
голосов
1ответов
1016 просмотров

How to update a jointable in CakePHP, manually

I am sort of a newbie with CakePHP. I have two tables: contacts and tags, and an HABTM table contacts_tags. User should be able to add tags as people can do in delicious.com. they get a list of tags as they type. They can also add new tags just by typing them. I want to check the tags table to se...

0
голосов
2ответов
162 просмотров

how to limit result based on the fields

How to use ' LIMIT' in mysql database query based on fields . just consider a user has 10 phone number and i would like to get only 5 phone number for that user . I would like to get only 5 phone numbers per user . not only 5 results from database ?

0
голосов
1ответов
307 просмотров

In toplink and struts 2 based application, even after commiting data data disappears from the database

I have a struts 2 application and a toplink persistence provider running on tomcat 6.0.20 and a MySql 5.1.38 server on a GNU/Linux machine. After committing the data the when i go to retrieve it the data it has disappeared from the database. I do a em.commit() and em.flush() after my queries ha...

3
голосов
3ответов
2105 просмотров

How to retrieve data which caused unique constraint violation (via Hibernate)?

Is there a way to find out which record caused such a violation in Hibernate? Normally you add objects to session and at the end you persist them. If such an error occurs it takes a while to track down which record has violated the constraint. Is there way to find out which record caused (eith...

11
голосов
8ответов
16651 просмотров

Alternative to the TimesTen in memory database

I just found "Has anyone published a detailed comparison between different in-memory RDBMSs?" that is related to my question. TimesTen (see also) is a In-Memory Database from oracle. It has a lot going for it including. Fast, consistent response time High transaction throughput S...

26
голосов
9ответов
6026 просмотров

When should I consider using a in memory database and what are the issue to look out for?

I was just think that now it is common to have enough RAM on your database server to cache your complete database why are the specialist in memory database (e.g TimesTen, see also Wikipedia page) that were all the rage a few years ago not being used more? It seems to be that as time go on, non...

5
голосов
2ответов
1488 просмотров

How to strengthen Mysql database server Security?

If we were to use server1 for all files (file server), server2 for mysql database (database server). In order for websites in server1 to access to the database in server2, isn't it needed to connect to to ip address of second (mysql server) ? In this case, is remote mysql connection. However,...

12
голосов
1ответов
2651 просмотров

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...

0
голосов
3ответов
2524 просмотров

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 si...

1
голосов
2ответов
3074 просмотров

CakePHP mathematic-calculation field?

(Database structure like 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. Is...

8
голосов
2ответов
4044 просмотров

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_m...

0
голосов
2ответов
283 просмотров

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...

0
голосов
1ответов
60 просмотров

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 ...

1
голосов
1ответов
2221 просмотров

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

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 t...

8
голосов
5ответов
394 просмотров

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 aft...

0
голосов
2ответов
65 просмотров

Connected to mysql instance ONCE or TWICE?

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_populat...

3
голосов
1ответов
6309 просмотров

How to use System.Web.Mvc.SelectListItem

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

3
голосов
3ответов
970 просмотров

Django database scalability

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 tabl...

0
голосов
5ответов
538 просмотров

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...