database

Deleting every nth row SQL

Say I have a table (id int, Name varchar) of 1000 rows. Now I wish to delete every nth record (every 2nd, 3rd or 5th) . What is the most efficient way to do this ? ...

Database architecture for millions of new rows per day

I need to implement a custom-developed web analytics service for large number of websites. The key entities here are: Website Visitor Each unique visitor will have have a single row in the database with information like landing page, time of day, OS, Browser, referrer, IP, etc. I will need to do aggregated queries on this database s...

OSGi bundle starting problem

I have a Java application. I created a OSGi bundle and in Activator.start i added MyMain Class.main() .Application started but it have a problem with DB connection. 'java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.' If i start my application as an application it works fine. What is wrong? Thanks a l...

Procedure failed to run shows error: Conversion failed when converting date and/or time from character string

Hi, I have written a simple procedure: CREATE PROCEDURE [dbo].[sp_GetPublishedDocs2] @FromDate as Datetime AS BEGIN DECLARE @strSQL VARCHAR(5000) SET @strSQL='SELECT * From Task WHERE 1=1 ' IF @FromDate <>'1/1/1900' SET @strSQL = @strSQL + ' AND Task.CreatedDate >= '+Cast(@FromDate as Datetime) EXEC(@strSQL) END It run succe...

How to delay ajax query?

I read a lot of questions, but they doesn't working in my case. My situation is: my ajax query to database to insert infromation. But in my web-application user can click on buttons very quick so previous ajax query is not finished, and there is where bugs are appear. All i need to do is a delay between queries, so future queries will do...

symfony database access configuration problem

Hi all, I just joined a web dev project that uses Symfony 1.4 on CentOS 5.4 with MySQL. The server is down. My first task in the project is to get it back up. I don't know a lot about Symfony. The Apache server log says Access denied for user 'root'@'localhost' (using password: NO) From all I can tell, the database access configuratio...

Hibernate/JPA: Mapping entities to different databases

Hi guys, I have an application which manages 3 databases. I use hibernate with JPA on seam framework. So I have a persitence.xml file with three persitence-unit like this (I remove properties for db2 and db3): <persistence-unit name="db1" transaction-type="JTA" > <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta...

Using Test::MockDBI multiple times with different results

Hi, I'm trying to test some code in different situations (for different result sets). I've got the first test running well, but the next one is trying to reuse the first "table". My result sets: my $usernames_many = [ { username => '1234567' }, { username => '2345678' }, ]; my $usernames_empty = [ ]; but now when I ...

User, customer, admin account in 3 different tables?

In my web application I will have three types of accounts. User: for using the web application for free Customer: for advertising and getting a Company Logo Admin: for editing and deleting stuff Should all these three be in separate tables or in one with a column named "account_type" where i can mark it as User, Customer or Admin? W...

Splitting mysql database per client

I am working on a database that is relatively small. It has a total of 67 tables, with a little over a million records. It is about 254 MB. The application that works with it has been running for about 5 years and the amount of usage has doubled each year. This year we are projected to triple which will just almost double the database in...

Need advice on archiving large SQL Server tables

Our SQL Server databases (SQL Server 2008 Standard edition, so to be R2) are getting bigger and bigger from years of data gets stored. So we are thinking of moving the old data (possibly older than a year) into an archive database. There are many reasons why we would benefit from having our production databases smaller. This is how I pl...

How to open a firebird .db table file using c#.Net

Hi, I have a Firebird .fdb file and can open it fine. But some tables are empty, and I can open the .db files of these tables using 3rd part programs. This was not developed by me. Now I need to open a .db from a table from firebird using c#.net Some knows how to do that? I dont want to open the database, connect to it, etc, just open ...

Is normalizing the gender table going too far?

I am not a database guy, but am trying to clean up another database. So my question is would normalizing the gender table be going too far? User table: userid int pk, genderid char(1) fk etc... gender table: genderid char(1) pk, gender varchar(20) Now at first it seemed silly to me, but then I considered it because i can then have a ...

how much data can a 5MB SQL database store?

Hi, I'm interested in using Heroku for my project. I'm not interested in paying for it at the moment but the free plan only offers a 5MB database. Is there any measure I can use to know how many columns/rows of simple text data can be stored in a 5MB database? Thanks ...

Is a database the right choice for data storage for my C# application?

Hi everyone, I am developing a C# application and want to be sure I choose the best choice for data storage that fits these specs. The program can have a infinite amount of data, but that data will only be used by a single user that is using the application. Each time the application is closed, I need to save the data, and it needs to ...

.NET Data Storage - Database vs single file

I have a C# application that allows one user to enter information about customers and job sites. The information is very basic. Customer: Name, number, address, email, associated job site. Job Site: Name, location. Here are my specs I need for this program. No limit on amount of data entered. Single user per application. No concur...

Proper way to build MVC for my application

I am scraping data from I want to scrape three search engines. In My queries_controller I will have a function search that calls $this->Query->find('$query'). My Model will hand this onto my own Database whose read() funcion will call three functions, searchGoogle($query), searchYahoo($query) and searchBing($query). The return values wil...

How reliable are mySQL stored procedures?

This not a go/no go question. I've used all kinds of 4GLs (PL/SQL, T-SQL, PGSQL etc.) for database back-end coding and find very useful to establish data layer "closest" to database engine. Now MySQL stored procedures got my attention and very interested in coding in this brand new 4GL platform. I would like to start using it in one o...

Normalize SQL table

Can we furthur Normalize this Sql Table Structue is Primary key is ID,Date,NAme,Type ID Date Name Type Value ----------------------------------------------------- 1 08/15/2010 Rating A+ 10 1 08/15/2010 Rating A- 10 1 08/15/2010 ...

Does a lot of repeated sum(x) in different cols make a Select slower?

I have a really big table with dozens of columns and lots of rows. Lets call this table FT. Everyday I run a script that reads data from the FT table, perform some calculations, and update a smaller table (table FA) that I use to generate reports. The query that update FA is something like: INSERT INTO FA (A, B, C) (SELECT sum(X),...