database

ROWID (oracle) - any use for it ?

My understanding is that ROWID is a unique value for each row in the result returned by a query. why we need this ROWID ?( there is already ROWNUM is ORACLE). Have any one used ROWID in sql query? ...

Open Source/ Free alternatives to Redgate Test Data Generator

I was wondering if there are any free / open source alternatives to RedGate's Data Generator. I do not care if the tool is script based, GUI based, written in anly language/platform. I should be able to target a SQL Server or MySQL schema and have test data generated for me which gets inserted into db directly or generate scripts for ins...

drop/truncate and rollback segment

I know that drop removes the data as well as the table structure whereas truncate retains table structure. Does drop/truncate write to roll back segment ? ...

How to use CASE in SQL , Syntax Error being shown

I am trying to retrieve some records from table based on my query but it shows me an error Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '> select vd.LedgerId,(CreditAmt-DebitAmt) AS NET, CASE NET WHEN NET > 0 THEN 'Debit' WHEN NET < 0 THEN 'Credit' ELSE 'Nil'End from dbo.vdebit vd INNER JOIN dbo.vCredit vc ON vd....

MySQL Error 1452 - Cannot add or update a child row: a foreign key constraint fails

I've looked at other people's questions on this topic but can't seem to find where my error is coming from. Any help would be greatly appreciated. I'm including as much as I can think of that might help find the problem: CREATE TABLE stocks ( id INT AUTO_INCREMENT NOT NULL, user_id INT(11) UNSIGNED NOT NULL, ticker VARCHAR(20) NOT NUL...

java class that simulates a simple database table

I have a collection of heterogenous data that I pull from a database table mtable. Then, for every unique value uv in column A, I compute a function of (SELECT * FROM mtable WHERE A=uv). Then I do the same for column B, and column C. There are rather a lot of unique values, so I don't want to hit the db repeatedly - I would rather hav...

Is there an open source database/key value for windows that allows me to dynamically add/remove nodes?

I'm looking for something like Riak, but which can run as a native windows application, and can handle failures, addition or removal of nodes, etc. The application is basically a search system. It comprises of a windows install which is installed within a company on people's individual machines. With each machine the system is deployed ...

Open source framework à la Microsoft Sync Framework suggestions?

We are implementing a warehouse management system atop an open source stack (Java, web services & friends). In this system, we want to integrate many mobile devices which should also be capable of adequate online/offline functionality, e.g. preparing database inserts while a mobile device is temporarily unconnected, and performing them o...

Zend Framework Relations vs. Table Select

Hey! I just want to know your guys opinion on using join tables within the zend framework. Of course you can use relations by defining a referenceMap and dependentTables and stuff, or using setIntegrityCheck(false) within a db select(). The setIntegrityCheck version seems a little bit dirty to me, but the other version is not very s...

How to specify the cardinality of a @OneToMany in EclipseLink/JPA

I'm trying to impose a @Oneto7 association. I'd have imagined an attribute that specifies the target many value, but have found none. If there is no such attribute, how else, in JPA/EclipseLink would one achieve it? ...

Is it faster to use a complicated boolean to limit a ResultSet at the MySQL end or at the Java end?

Lets say I have a really big table filled with lots of data (say, enough not to fit comfortably in memory), and I want to analyze a subset of the rows. Is it generally faster to do: SELECT (column1, column2, ... , columnN) FROM table WHERE (some complicated boolean clause); and then use the ResultSet, or is it faster to do: SELECT (...

Default Database Collations got messed up

I am using Ubuntu 9.10 with XAMPP ( Lampp "MYSQL 5.1.45 PHPMYADMIN 3.3.1 PHP 5.3.2 ) What my problem is, is that I set up my testing env to debug my scripts locally and when I did so there arose a problem. This problem is that I used firefox's addon SQLinject ME to test for weakness' and upon doing so it caused mysql to change the defaul...

Database scaling question

My app has outgrown just the one vps server (using Mediatemple DV). I want to put the database on another server. Does it have to be another Mediatemple server? Is it possible to use another hosting company and will the connections across the internet cause a slowdown if I choose to use say Rackspace or Linode for the DB server? btw,...

How to organize live data integrity tests and code unit tests?

I have several files with code testing code (which uses a "unittest" class). Later I found it would be nice to test database integrity also. I put this into a separate directory tree. (Things like the keys have correct format, parent and child nodes are pointing correctly and such. Edit: this is a nosql project, where I can not rely on ...

smallest mysql type that accomodates single decimal

Database newbie here. I'm setting up a mysql table. One of the fields will accept a value in increment of a 0.5. e.g. 0.5, 1.0, 1.5, 2.0, .... 200.5, etc. I've tried int but it doesn't capture the decimals. `value` int(10), What would be the smallest type that can accommodate this value, considering it's only a single decimal. I...

Cities to Metropolitan areas

Hi all, I have a database of cities (in both the US and the rest of the world). The database entries are simple text strings. Currently the database contains even small cities (population 10,000). I wish to use a larger scale database instead, by assigning the cities into larger geographical\metropolitan areas. An example can be the Me...

general things developer must know having 2+ years of exp?

Hi All, I have 2 years of experience in Ruby on Rails. I have basic knowledge (very bsic) of mysql such as data insertion, join, select from more than one table. But now I want to know more about it because my friends are having trouble in interviews when they are asked questions like: What is the trigger? which trigger is called whe...

How to establish secure connection between java application and database?

In an interview, Interview asked me an question : The communication between our application and the remote database must be done with https (more secure). How could you do it? I didn't find any clue for this question in google also. How to establish secure connection between java application and database? Please help me. ...

Query that ignore the spaces.

What's the best way to run a query so that spaces in the fields are ignored? For example the following queries.... SELECT * FROM mytable WHERE username = "JohnBobJones" SELECT * FROM mytable WHERE username = "John Bob Jones" . would find the following entries: John Bob Jones JohnBob Jones JohnBobJones . I am using php or python...

Database persistence without an SQL server

I'm seeking a solution that would allow persistence without requiring an SQL server to be installed on the host and could be bundled along with a desktop application. Does such a thing exist? ...