database

primary key on very small table

Hi, I am having a very small tables with at most 5 records that holds some labels. I am using Postgres. The structure is as follows: id - smallint label - varchar(100) The table will be used mainly to reference the rows from other tables. The question is if it's really necessary to have a primary key on id or to have just an index on ...

Free portable database

Hi I am developing desktop portable free application and I`m looking for portable database: free without install up to 20K records standalone application supports encryption (optional) SQL92 spec thanks for advice can you write some advantages and disadvangtages? ...

How create role to put in the database???

Hi all, i wish create a role for each user after that the user authenticate(login) to access to the application i will give some role to and save the role on the database. I will make an example with the database "aspnet.mdf" and Linq toSql to store data but before i need know how create role in c#(WPF) and after created i wish add ro...

Where to store database credentials in a web app?

I'm wondering what techniques you use to store the database credentials for your application. I'm specifically concerned with java webapps, but I don't think there's any need to limit the questions to that. things to consider: Do you use property files,xml configs, other? Is it bundled into your application(ie in a jar file) or store...

Dynamically fill in form values with jQuery

I know how to do this with pure PHP but I need to do this without reloading the page. Is there anyway with jQuery to effectively pull back some database results (based on what a user has input in the first text field on a form) then populate some of the remaining fields with data pulled back from a db query? Essentially I would like to...

Saving HABTM records when not all join table columns are foreign keys

I am trying to update tables with a has and belongs to many (HABTM) relationship. When my join table looked like this: CREATE TABLE IF NOT EXISTS `items_labels` ( `item_id` int(11) NOT NULL, `label_id` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; I use CakePHP, so I could update the tables with $this->Item->save($data) ...

SQL query to return top N rows per ID across a range of IDs

Lets say I have a table containing several hundred million rows that looks something like this: memID | foo | bar | foobar 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 1 | blah | blah | blah 2 | blah | blah | bl...

How to predict MySQL tipping points?

I work on a big web application that uses a MySQL 5.0 database with InnoDB tables. Twice over the last couple of months, we have experienced the following scenario: The database server runs fine for weeks, with low load and few slow queries. A frequently-executed query that previously ran quickly will suddenly start running very slowl...

Defining the database schema in the application or in the database?

I know that the title might sound a little contradictory, but what I'm asking is with regards to ORM frameworks (SQLAlchemy in this case, but I suppose this would apply to any of them) that allow you to define your schema within your application. Is it better to change the database schema directly and then update the column types in yo...

What is a maintainable way to store large text fields without sacrificing performance?

I have been dancing around this issue for awhile but it keeps coming up. We have a system and our may of our tables start with a description that is originally stored as an NVARCHAR(150) and I then we get a ticket asking to expand the field size to 250, then 1000 etc, etc... This cycle is repeated on ever "note" field and/or "descriptio...

sql session time out recommondation

One of my applications uses sql session state, the timeout is currently set to 20 minutes. My question is, since this is stored in the database and not in server memory, I should be able to increase the timeout without any significant performance issues right? I dont really understand the importance of the timeout for the database sess...

(How can/What should) I implement a database that scales to the upper tens of thousands requests/second?

By Upper tens of thousands requests/second I want to see 60,000 -> +90,000 requests/second. My Setup consists of the following: user ---> web app --> message queue --> parser --> database? I should mention that the parser currently can parse/stuff around 18750 records/second using COPY so we are limited on that end until we start addi...

MySQL Stored Procedure add row and return key

The question I have been asked for this assignment is: Using a sample data, add a new incident and a call record in a single transaction. However I know it doesn't read to well and that's because of the language that my lecturer uses. But from what I gather he would like me to add a record to an incident table and...

Recording test data in Hibernate

I have an automated test framework for testing hardware widgets. Right now only pass/fail results of test cases are stored into a relational database using hibernate. I'd like to change this so that various characteristics of the test are stored in the database. (e.g. how many gerbils are running inside the widget, the inputs to various ...

What percent of your codebase is represented by Data Access code?

An interesting question came up on twitter tonight and I tought I'd post it here. Basically, I am wondering what you are using to persist data to your database and an estimation of the percent of your codebase that is data access code. -- Edit -- Other interesting metrics (as noted in the comments) include the number of business clas...

What are the steps for connecting jdbc with mysql

I'M NOT ASKING ABOUT THE CODE. I just want to know what are and all the steps involved in the connection other than coding. I'm using j2sdk1.4.0 and MySQL Server 4.1. Am very new to this area. Thanks in advance ...

How do I handle long comparisons in SQL

I have a pathological issue with SQL, so I usually sort all of my database issues by building quickie software applications to handle my SQL problems. (as I am also doing in this case) Thanks to StackOverflow I think I can be shamed into correctness, so I would like to learn how to make this kind of SQL troubleshooting in actual SQL o...

Database replication for redundancy using a free database and a Java with Spring & Hibernate web application

Hi, I have this in mind: On each server: (they all are set up identically) A free database like MySQL or PostgreSQL. Tomcat 6.x for hosting Servlet based Java applications Hibernate 3.x as the ORM tool Spring 2.5 for the business layer Wicket 1.3.2 for the presentation layer I place a load balancer in front of the servers and a rep...

Simple database-based instance synchronization

I'm working on a service that runs in a java app server farm that needs to do some periodic jobs (say, once every 2 minutes). The service must interface to external entities, and it is necessary to synchronize the different instances so that only one of them works on the job at a given time. Since the service uses a DB during this job,...

How to convert an Access database to SQL?

Hi. I want to convert my Access database to SQL because my host only supports importing a database through SQL in their phpmyadmin. ...