database

Best practice? open and close multi connections, or one large open connection for ado.net

I am using ADO.Net for some database connectivity and I was just hoping I was doing it the right way. I am opening and closing multiple connections for each stored procedure. Or should I be wrapping this up in just one open connection (less resource on the database maybe?) thanks, and if there is anything odd or something I could be do...

ContextSwitchDeadlock Exception while inserting data to sqlite database

I have a Sqlite Database where I am enumerating my directory structure and inserting records into 5 different tables. Total Files + Folders count = 4000. Also there is nested loops. Can say all loops runs for 4000 times cummulative to insert the records. Earlier it was built with Sql Server where it was running absolutely fine. It was t...

.NET Parameterize Queries Injection

Are Parametrize Queries in .NET safe from SQL Inject? That is, does .NET automatically escape dangerous characters when you use Parameters? ...

What kind of application would CouchDB be most useful/performant for?

I've been messing about with the Ordnance Survey Code-Point Open dataset of UK postcodes/co-ordinates. Since Couch.io were offering a free hosted CouchDB instance I thought I'd put my geo data into one of those, learning a bit about CouchDB in the process. The idea was that since CouchDB is supposed to be good at handling large datasets...

What obstacles have you encountered when developing apps with your development tool?

I'm debating whether to re-write my INFORMIX-SQL app with I4GL (character-based) or another Windows/GUI-based tool. I want to know specific instances of limitations, bugs or drawbacks of using another development tool before I invest considerable amount of time evaling another product. Answers to this question could save me a lot of tim...

Lucene Search Problem

I have built an index on my database rows (Each row as a document) which are of unicode type in MySQL(i.e. Charset: utf8 and Collation: utf8-bin). But When I search any word English or non-English it gives me no answers. It says: 0 total matching documents My code is the demo code of lucene for search except that I have changed fie...

What kind of, does there exist a, data framework like this?

What I want to do is: Load values for a program from a file. Read/Add/Change those values. Save those values back to the file I would like to be able to have a database be the file I want as much of the data as possible to stay in memory, so I'm not hammering the file I would like to query using Linq or be able to use a Standard Query ...

Mysql auto increment alternatives

Hi, I have the below table. create table mytable( physical_id int auto_increment, logical_id int, data varchar(20), version_start_date datetime, version_end_date datetime, primary key(physical_id), unique key(logical_id,version_start_date, version_end_date) ); The idea behind the schema is, I want to keep track of modification to ev...

H2 Database vs SQLite on Android

Because of the lack of Unicode support on the embedded SQLite database in Android I am mostly interested in performance and stability of H2 Database vs Android SQLite Are you guys using it? Should I be aware of any H2 database shortcomings? ...

Free database with places, parent places, latitude, longitude, etc.

Where to find free database of wolrd places with following fields: id place name in English place name in original language place type - city, region, state, country, continent, etc. latitude longitude parent id - id of place which current place belongs to, for example, San Francisco belongs to California, but California belongs to US...

Is it bad to use redundant relationships?

Suppose I have the following tables in my database: Now all my queries depend on Company table. Is it a bad practice to give every other table a (redundant) relationships to the Company table to simplify my sql queries? Edit 1: Background is a usage problem with a framework. See http://stackoverflow.com/questions/3331310/django-limit...

Hibernate optimistic locking..how it works??

Hi, I was reading the below blog about hibernate optimistic locking. I am planning to use it with hibernate. But, I have one concern. we have java code and c++ code, both connect to one database. While, java code can use hibernate to achieve optimistic locking, I want to make the c++ code do the same thing. Also, c++ code is using some ...

SQL Type-casting

I'm dividing some integers x & y in MS SQL, and I wan the result to be in a floating-point form. 5/2 should equal 2.5. When I simply do SELECT 5/2 I get 2, which doesn't suprise me, since it's creating an int from two ints. I know I can force it to a float by doing: SELECT CAST(5 AS FLOAT)/CAST(2 AS FLOAT); but that seems like ...

Mysql custom sequence generator ( like oracle)

I want to have two auto_increment column's per table, but mysql allows only one auto_increment columns. So, I tried replicating the oracle sequence using my own table. Here is the schema. create table logical_id_seq ( logical_id int auto_increment, primary key(logical_id) ); create table mytable ( physical_id int auto_incr...

Database interaction code

Hi there I'm writing a small application that works with a database and I can't figure how to test this interaction. My application relies on 5 stored procedures that I have decided to encapsulate them in a class. This class offers 5 public methods that execute the procedures and, when necessary, convert the results into collections of ...

Need help with Database Access in Android

I'm using an sqlite database in my app. I have this dbhelper class in a services class like so. public class MushroomService { private int downloadprogress; private int databasesize; private DataBaseHelper myDbHelper; } public MushroomService(Context context) { myDbHelper = new DataBas...

"caching" an array of database values in php (2 options, which is better?)

(I use the word var in the following because I'm not sure what it is I think it's a global variable for the class) I want to cache values that are gotten from a table in a database, to save repeated queries. What I've done is create a singleton class which has a function to check a var within the class if a key exist, if it does then ju...

Is saving enormous user information into a MySQL table good if one wants to display it for later use?

I have a file named discussion.php, where a form is located. In this form, a user will enter information, and the information will be posted to savedisc.php. Below is the code for discussion.php: <form action='savedisc.php' method='post'> <p>What would you like to discuss?</p> <textarea name='message' rows='15' cols='40'></textarea>...

Rails join tables or HABTM associations

In the application I'm building, I want to have Events. People can then register for the event by creating a team, by directly registering for an event (no team), or by joining an existing team. I originally set it up as Event has_many teams, Team has_many users, user belongs_to Team and Event. However, I foresee problems if a registe...

Same foreign key in multiple tables

I've seen posts on SO and through google stating that with Mysql you cannot have multiple foreign keys of the same name. My issue is how do I reference the same column from one table in multiple other tables. In my case I have a FAMILY table that contains FAM_ID. I want this to be a foreign key in my DOCUMENTS and CONTACT tables because ...