database

Clojure read Blob from database

I need to read bytes from this Blob. I'm trying the following but I'm getting this exception: oracle.sql.BLOB cannot be cast to [B (defn select-test2[] (clojure.contrib.sql/with-connection db (with-query-results res ["SELECT my_blob from some_table"] (doall res)))) (defn obj [byte-buffer] (if-not (nil? byte-buffer) (with-o...

Selecting data from database based on numbers

Hey, guys, I'm trying to figure out how to select data from a MySQL table based of closeness to a number. Here's what I mean. I'm writing an application that stores the coordinates of places (longitude and latitude) what I'd like to be able to do is select data from the database based on the location of where the user is. So, say, for ...

Simple way to storing data from multiple processes

I have a Python script that does something along the line of: def MyScript(input_filename1, input_filename2): return val; i.e. for every pair of input, I calculate some float value. Note that val is a simple double/float. Since this computation is very intensive, I will be running them across different processes (might be on the s...

Selecting WHERE date is greater than current date

I have the following query: SELECT id FROM auctions WHERE end_dt > TIME_TO_SEC(TIMEDIFF(end_dt, now())) > '0' GROUP BY auctions.id ORDER BY end_dt ASC LIMIT 15 This is really slow. But basically, we're trying to select the most recent 15 records that are about to "end" by checking if the amount of seconds left is greater than zero. ...

Mysql Connector .Net is taking more than 40 mins to update database model

Hello Everyone, I am using MySql Connector 6.2.3 with Visual Studio 2008 and i have a database with 119 tables, which is constantly growing. When i want to update the entity framework model "Update Model from Database" option from visual studio it is taking more than 40 mins to update, that is killing my productivity. Is this happening...

Clojure how to insert a blob in database?

How to insert a blob in database using the clojure.contrib.sql? I've tried the following reading from a file but I'm getting this exception: SQLException: Message: Invalid column type SQLState: 99999 Error Code: 17004 java.lang.Exception: transaction rolled back: Invalid column type (repl-1:125) (clojure.contrib.sql/with-connection...

What are the design criteria for primary keys?

Choosing good primary keys, candidate keys and the foreign keys that use them is a vitally important database design task -- as much art as science. The design task has very specific design criteria. What are the criteria? ...

Is there any efficient way to make Android database query faster ?

In my android app i need to get 50,000 database entry(text) and compare them with a value when the activity started(in onCreate() ).I am doing this with the simplest way : i get the whole table from db to a cursor.However this way is too laggy.Are there any other way to do it more effective ? Edit :The app is "scrabble solver" that is w...

Looking for more details about memory map in MongoDB

Hi I am looking for more details/docs or anything else about 'memory map mechanism' in MongoDB, and wondering how they use this to achieve high performance. Anyone could help? Thanks in advance~ ...

How to select records one by one without repeating

select id, name from customer order by random() limit 5; The above query select random records. However it repeats rows. I just want to select a single row each time without repeating. Say i have id 1 to 5. For first time i want to select 1, second time the query displays 2 then 3,4 & 5. Once the sequence is completed it starts again w...

Rails: Getting an array of object ids by query/conversion (for comparision)

Basically, I want an array of ids from the database. Some background: I'm rendering a list of objets (foos) to the user with a checkbox. If the user checks the box a row is create in a different table (bar) when rendering the foo list + checkbox I want to check if the unique id any given foo already exists in the bar id array. I ...

Rows without repeating records

id | name -------+------------------------------------- 209096 | Pharmacy 204200 | Eyecare Center 185718 | Duffy PC 214519 | Shopko 162225 | Edward Jones 7609 | Back In Action Chiropractic Center I use select id, name from customer order by random() There are 6 records i just want that when ever i query, i will get a uniq...

View Database (MY SQL)

Hey All, I have SQLDBX, And it works perfectly for MSSQL, but it doesn't work for MySQL. And I would like to know if any of you know of any database viewers that can connect to MySQL database on a server? Just something simple I guess, doesn't have to be brilliant, just has to work Thank you :) ...

which one faster to access one large field or multiple small fields with equal data length?

hi .... i am in litle confusion.... Let we have a large field in the database,and same field is splitted in the other table. eg address(containing all city state ,country) in table1... and add, city,state,country in table2... all are separte column. i need complete address which on is faster.. Select address from table1 (larger data ...

split array values when there is a comma

hi i'm able to split a string into an array $array = preg_split("/[\s]*[,][\s]*/", $category); RESULT Array ( [0] => jquery[1] => bla[2] => bla); but now i have a database with a row holding all by categories ("cat1, 2, 3, ..") - multiple records have similar categories- so in order to create a quick "category" menu i'm using th...

Backup Sql Express

I would like to be able to run an on demand backup of a .Net MVC app's SQL Express 2008 database to eg a flash stick plugged into the machine running the app. I tried QuickstemDataContext db = new QuickstemDataContext(); string quickstem_path = Path.Combine(save_path, "quickstem.backup"); db.ExecuteCommand(string.Format("BACKUP DATA...

Data encryption issues with oracle advance security

HI all, I have used Oracle Advanced Security to encrypt data during data transfer. I have successfully configured ssl with below parameters and I have restarted the instance. I am retrieving data from a java class given below. But I could read the data without decrypting, the data is not getting envrypted. Could you please help. Environ...

sql select * between exact number of rows.

Hi all, I would like to know if I could using select statement retrieve exact position of the rows. e.g rows between 235 & 250. Is this possible? Thanks in advance, shashi ...

Read-only, rather small database - ways to optimise?

Hi all, I have a following design. There's a pool of identical worker processes (max 64 of them, on average 15) that uses a shared database for reading only. The database is about 25 MB. Currently, it's implemented as a MySQL database, and all the workers connect to it. This works for now, but I'd like to: eliminate cross-process data ...

MySQL: One row or more?

I have any kind of content what has an ID now here I can specify multiple types for the content. The question is, should I use multiple rows to add multiple types or use the type field and put there the types separated with commas and parse them in PHP Multiple Rows `content_id` | `type` 1 | 1 1 | 2 1 ...