database

Round-tripping SubSonic DAL objects with WCF

Question: How do I preserve "dirtiness" of SubSonic objects when they are sent back and forth across a Windows Communication Foundation service? To wit: I have a WCF service call that returns a collection of SubSonic (2.2) objects, like so: // WCF server side public MyObjectCollection GetAllMyObjects() { // Retrieve a MyObjectColle...

Run a script based on timestamp entered in MySQL database

Hi I have a requirement to run a server script on scheduled times entered by the user. This is for a program for scheduling emails. A user can enter the specific times when they want to send the mail. I have a table which stores the userid, the email text and the time at which the mail is to be sent. This time is defined in minutes. I d...

Query/Database Optimization: How to optimize this? (and should I use a materialized view?)

Hi -- I have a question on how to optimize a query. Actually, as I'm going to be running the query frequently, I was thinking of using a materialized or indexed view (is this a good idea here?) or denormalizing. Consider the following four tables (with irrelevant fields omitted): Users (int userId) Groups (int groupId) GroupMembershi...

Mysql restore database through stored procedure

Hi All, I want to restore mysql database through stored procedure? Is it possible? Or can I copy dbfile and rename that folder? Please let me know if anyone needs more information to answer this question. Thanks in advance. Regards, Manasi ...

MySQL ignores my index

I'm quite new to setting indexes myself. I'm currently just experimenting with it to discover how it works and in what cases a database will make use of the index. I've got a simple table with 3 columns; an id, a name and a status. I've set an index on the name which is a CHAR(30) column. Against my expectations, MySQL ignores this inde...

Implementing a database record hash for keeping track of whether a record has changed or not

I have database schema for an integration project in which I need to be able to query for records that have changed, but only based on a given set of fields within that record. So, for instance, here's an example table: CUSTOMERS ID Name Phone Fax Balance I need to be to query to fetch records whose Name, Phone, or Fax fields have...

Can anyone explain to me(beginner) in plain english what "Schema" means?

I need a plain english explanation of "schema" as in Database schema & Xml schema. EDIT: When someone says to create a database schema, does it mean creating constraints for the fields in the tables? ...

How do I show the schema of a table in a MySQL database?

This is a question I did not find answered in Stack Overflow: How do I show the schema of a table in a MySQL database? The answer is to read about the describe command. ...

Selecting rows between x and y from database

I've got a query which returns 30 rows. I'm writing code that will paginate those 30 rows into 5 records per page via an AJAX call. Is there any reason to return just those 5 records up the presentation layer? Would there be any benefits in terms of speed or does it just get all the rows under the hood anyways? If so, how do I actually...

Database vs Flat Text File: What are some technical reasons for choosing one over another when performance isn't an issue?

Hello All, I am having a problem in one of the teams that I am working in. One of the guys is a bit SQL happy in my opinion and wants to store the log information generated by a small python FTP downloader into a database, instead of just a nice formatted text file. Now its always been my opinion that a database should only be used if...

Clarification on DBMS Locking

I'm taking an intro class on database management systems, and had a question that wasn't answered by my book. This question is not from my homework, I was just curious. The textbook continually stresses that a transaction is one logical unit of work. However, when coming across the shared/exclusive locking modes, I got a little confused...

When to use a key-value data store vs. a more traditional relational DB?

When would one choose a key-value data store over a relational DB? What considerations go into deciding one or the other? When is mix of both the best route? Please provide examples if you can. ...

seam 2.2 with microsoft access

is it possible to import a MS access database (.mdb) in a seam project using JBoss tools within Eclipse (Ganymede)? Starting a new seam project, I cannot see any field which uses ms access as database type. Any answer is appreciated. ...

Is it good practice to use one single stored procedure that accepts a variable number of parameters

I am working on a web project where I have to retrieve (let's say) employee records. In some cases I have to retrieve a single record by providing an EmployeeID. In other cases, I have to retrieve multiple employee records by providing a SectorID. This logic could be expanded to cover additional scenarios: get all employee records, get e...

Populating a database after "Sign Up"

I would like to populate various tables in my database after a new customer signs up to use our web application. I'm wondering what the best way to do this is, the main requirement being that it should not require any intervention by me. Most of the data is static (but can be changed by the customer later (like preferences for example)),...

Syntax error with emulating "create user if not exists"

MySQL does not allow you to specify an if not exists clause in a create user statement (despite the fact that create table and create procedure do support this). There was a feature request for this in 2005 but the MySQL devs have done sod all about it, so it's probably not going to happen anytime soon: http://bugs.mysql.com/bug.php?id=...

What are the strategies for a really fast single table database?

Hello there! I have a database in SQL Server 2008 that supports various applications. I am now starting the development of a new application and, from that database, I require data that fits in one table (though there is some replication). The data I way may be extracted to a view (a few inner joins) with 6 columns. I'm developing a we...

Is there a way to use System.Transactions with connection pooling?

I think the System.Transaction classes in Framework 2.0 are a great tool, well designed, aimed to simplify code when working with transactions. But, (big but), it's impossible to use those classes with multiple connections to the same database (same connection string) without promoting to distributed transactions. http://social.msdn.m...

How to generically/dynamically create/drop users

(Related to, but separate from http://stackoverflow.com/questions/1502885/syntax-error-with-emulating-create-user-if-not-exists.) Is it possible to achieve the functionality of generically/dynamically adding a user (i.e. emulating the sp_adduser system procedure included with other DBMSs) in MySQL? MySQL doesn't support the following i...

dynamic column formatting in sql - and a backend to store the formatting

Hi all, I'm trying to create a system in Python in which one can select a number of rows from a set of tables, which are to be formatted in a user-defined way. Let's say the table a has a set of columns, some of which include a date or timestamp value. The user-defined format for each column should be stored in another table, and querie...