database

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, I seen from some people comment on the se...

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 Standard SQL, no application rewrite Persi...

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

Hi, 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 (either to "toString() in case of new obje...

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

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 see which tags are already present and which...

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

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.INSTANCE_ID = b.INSTANCE_ID where a.ID = b...

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 in such a way that deleting the Customer wo...

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 each row. Here's the suggested table str...

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 (out of memory) on 0x0 when preparing 'DELE...

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

Activity list ala SO

Hi, 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 the activity is for) Type (Type of ac...

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 most the database tools let you). Can I ...

ASP.Net - Updating rows in a database

I am using visual basic for coding. Here's my code. Protected Sub savebutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles savebutton.Click Try conSQL.Open() Dim cmd As New SqlCommand("select * from Phd_Student where student_id = '" + Session("idno") + "'", conSQL) Dim builder = New ...

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

Metaprogramming a wizard and database rules

Our software has a few places where it uses wizards to collect information from users then generates a bunch of database entries based on what users enter into those wizards. Currently these wizards and the rules for generating database entries from the wizards are handled by many kLOC of unmaintainable C++ code. In the spirit of The P...

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

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, blank=True, unique=True ) def __unicode__(self):...

Execution Plans for Databases

Question 1: When we execute a query, does the execution plan change for each and every time when executing the query? If yes, any performance hit? If no, then if we change something in the table, i.e adding an index, how does the databse know that there is something it can use to change the execution plan for faster execution? QU...

How do I create a new Firebird database from the command line?

I'd like to create a new Firebird database in my C# client application. Is there a command line utility that lets you do this? ...