database

Can I use DataTables to import data from one database into another?

I need to create a quick and dirty solution to migrate data from database into another. This is only being used a proof of concept. Long term we will use .NET's Sync Framework. The databases are identical. The solution is going to be used as an OCA (occasionally connected application). I read in which tables they want to migrate fro...

Sending a data to a Web server

Hi, I have already finished my iphone app, but I would to add some monitoring to it on my Web site. What I want is get a location of the device (state, country) that using my app and then after I got the location I want to send it to a Web Server. Then in my site I will create a report of how many user's of my app. I haven't work on W...

Clear all the rows in a table resetting the identity specification back to zero and without affecting the foreign keys?

We have already created the database framework, with all the relations and dependencies. But inside the tables were just the dummy data, and we need to get rid of these dummy data, and start adding the correct ones. How can we clear everything and leave the primary keys (IsIdentity: yes) back to zero, and also without affecting the forei...

Row count of a column family in Cassandra

Is there a way to get a row count (key count) of a single column family in Cassandra? get_count can only be used to get the column count. For instance, if I have a column family containing users and wanted to get the number of users. How could I do it? Each user is it's own row. ...

ASP.NET MVC routing based on data store values

How would you tackle this problem: I have data in my data store. Each item has information about: URL = an arbitrary number of first route segments that will be used with requests some item type = display will be related to this type (read on) title = used for example in navigation around my application etc. Since each item can ha...

Creating android app Database with big amount of data

Hi all, The database of my application need to be filled with a lot of data, so during onCreate(), it's not only some create table sql instructions, there is a lot of inserts. The solution I chose is to store all this instructions in a sql file located in res/raw and which is loaded with Resources.openRawResource(id). It works well but...

Additional SQL Server sample databases to practice with

I'm helping a friend learn SQL, and need more databases to help him get more practice. We have of course AdventureWorks, Northwind, and Pubs. Does anybody know of any other SQL databases samples that might be available to download? I know some sites have some databases where you can practice queries on the site, but I was looking for s...

Mysql Constraign Database Entries in Rails

I am using Mysql 5 and Ruby On Rails 2.3.1. I have some validations that occasionally fail to prevent duplicate items being saved to my database. Is it possible at the database level to restrict a duplicate entry to be created based on certain parameters? I am saving emails to a database, and don't want to save a duplicate subject line...

Error Executing Database Query. MySql, Dreamweaver and Coldfusion.

I am trying to insert data into my database, but keep getting error 1064. Which goes like this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Add, Username, TalkID) VALUES ( 'trial' , 'andy' , 2 )' at line 1 The error occurred in C:\ColdFusion8\www...

Separate calls to Db data in one foreach loop

OK I hope this isn't too specific. I have a database driven CMS that a coworker uses with many categories in it. Here's how it echoes some products we have now: $offers = get_offers('category1','none','compare'); foreach ($offers as $row) { $offername = $row['name']; $offerlogo = $row['logo']; $offera=$row['detailA']; ...

Unsupported SQL Type 1111 when passing String to a VARCHAR field

I have been smashing my head against this for a while now. I am using iBatis with my JAVA code to run Stored Proc residing in Sybase DB. Stored procedure is expecting some parameters. few of them are declared as VARCHAR (6) So in my iBatis mapping i did the following for those parameters. <parameter property="searchUserId" jdbcTyp...

Importing a (mysql) database dump programmatically through Java

Hi All, How can I import a mysql database dump file (contains insert and create table statements) programmatically through a java program. I need this as the setup phase of a unit test. Unfortunately this doesn't work: Connection conn = dbConnectionSource.getConnection(); Statement stmt = conn.createStatement(); stmt.execute(FileUtil...

Need a .NET database versioning script runner

Hi Guys, I'm looking at versioning databases and came across the usual articles regarding how to do this (coding horror, ode to code, etc). This all make perfect sense to me, however I'm trying to find a script runner that will run the sql scripts for me. All these articles mention having something to run them automaticaly, but none of ...

MySQL: Removing duplicate columns on Left Join, 3 tables

I have a table that uses 3 foreign keys into other tables. When I perform a left join, I get duplicate columns. MySQL says that the USING syntax will reduce the duplicate columns, but there aren't examples for multiple keys. Given: mysql> describe recipes; +------------------+------------------+------+-----+---------+-------+ | Fiel...

Is it better to use an in-memory database (e.g. SQLite) than to keep everything in HashMap or other data structures?

I need to have very fast access to a big Map - several millions of entries. Is it worth using an SQLite in-memory database to keep that map as opposed to just having that HashMap in memory? ...

Primary key as INT and global key as GUID for improved performance.

Hello. While deciding upon the keys for a table, is it good to have an INT primary key (autoincrement) for the table and a GUID (in addition to the INT) for the scope of the database? Given that there will be more table DML statements it will be faster to operate on INT whereas if any pan-database DMLs statements are to be executed, GUID...

How bad is it to change the structure of big tables?

My target DB is MySQL, but lets try to look at this problem more "generic". I am about to create a framework that will modify table structures as needed. Tables may contain a hundred thousands of records some day. I might add a column, rename a column, or even change the type of a column (lets assume that's nothing impossible, i.e. I mig...

Compare 5000 strings with PHP Levenshtein

I have 5000, sometimes more, street address strings in an array. I'd like to compare them all with levenshtein to find similar matches. How can I do this without looping through all 5000 and comparing them directly with every other 4999? Edit: I am also interested in alternate methods if anyone has suggestions. The overall goal is to fi...

The best choice for Person table primary key

What is your choice for primary key in tables that represent a person (like Client, User, Customer, Employee etc.)? My first choice would be an SSN number. However, using SSN has been discouraged because of privacy concerns and different regulations. SSN can change during person lifetime, so that is another reason against it. I guess th...

CakePHP custom database session handler

In cakePHP, does anyone have any experience creating a custom Session handler that records extra information to the database. Say you wanted to record the IP and the User Id (if they login using Auth) to the sessions table using a custom handler. Where would you start? I have seen the cakebook, but it doesn't talk about custom database...