database

What is the purpose of constraint naming

What is the purpose of naming your constraints (unique, primary key, foreign key)? Say I have a table which is using natural keys as a primary key: CREATE TABLE Order ( LoginName VARCHAR(50) NOT NULL, ProductName VARCHAR(50) NOT NULL, NumberOrdered INT NOT NULL, OrderDateTime DATETIME ...

How to store and retrieve images in sql server database through VB.NET

SQL Server supports the ability for clients to store objects within tables. Create Field that data type Image and Initialize byte array with a null value initially.Use FileInfo object to get file size.Open FileStream to read file.Use ...

When scraping a lot of stats from a webpage, how often should I insert the collected results in my DB?

I'm scraping a website (scripting responsibly by throttling my scraping and with permission) and I'm going to be gathering statistics on 300,000 users. I plan on storing this data in a SQL Database, and I plan on scraping this data once a week. My question is, how often should I be doing inserts on the database as results come in from ...

is there any database transaction mechanism in MFC/C++?

I want to make sure that if any error occurs during the database processing phase, program will know it need to roll back the whole process. any good ORM in MFC/C++ for doing this ? ...

How can I query rankings for the users in my DB, but only consider the latest entry for each user?

Lets say I have a database table called "Scrape" possibly setup like: UserID (int) UserName (varchar) Wins (int) Losses (int) ScrapeDate (datetime) I'm trying to be able to rank my users based on their Wins/Loss ratio. However, each week I'll be scraping for new data on the users and making another entry in the Scrape table...

How to store data permanently in database using C#?

In my project I used C# with MS Access but data can't be stored permanently. I placed the database file in the project work space, but this did not solve my problem. Please provide connection string for that. ...

How to speed up this query?

ATM I am trying to learn how to efficiently use database inidices and would appreciate to get some expert input. I do not have any performance issues currently. I would just like to know, how you would handle your indices with this query: SELECT B.event, COALESCE(B.system, C.surname || ' ' || C.forename) AS name, C.label...

How does database connection works in php-mysql

Is it better to close the connection after each query is executed or put the connection as is it, then php will automatically close that connection. Which one is better and why? ...

Production release of NHibernate

I am trying to get started working with NHibernate. I went to download the latest production release at https://www.hibernate.org/6.html. The NHibernate download says development beside it, whereas other downloads say Production. Is this what I want? ...

How to check, if a value is an integer with plpgsql?

i am using this function in a trigger: CREATE OR REPLACE FUNCTION xx() RETURNS trigger AS $xx$ BEGIN INSERT INTO my_log (x, y, z) VALUES (NEW.x, NEW.y, current_setting('myvar.user')); RETURN NULL; END; $xx$ LANGUAGE plpgsql; now i would like to check, if 'myvar.user' is a valid integer, and if not, do anothe...

Ruby Kirbybase Server/Client Mode Problem

I'm trying to use the KirbyBase (in Ruby) in server/client mode and having some problems... Here's the setup (I'm working with a speacilized embedded linux system (explained at the bottom of post) but; I'll call those PC for the arguments sake) 2 PCs using an NFS mounted NAS drive on network (mounted on /mnt/sharedSpace), one will be s...

Merging DB Content From 2 DBs, Need To Avoid Non-Exact String Likenesses

Maybe I am day-dreaming but I am about to merge the contents of two large tables which represent two companies versions of the same data. I'd like to avoid duplicates (entries with the "title" field from DB 1 being almost the same as the "title" from DB 2. Are there any methods in php or mysql do do close string matches and return a rele...

Database transaction only partially committing

I've got a T-SQL stored procedure running on a Sybase ASE database server that is sometimes failing to commit all of its operations, even though it completes without exception. Here's a rough example of what it does. BEGIN TRANSACTION UPDATE TABLE1 SET FIELD1 = @NEW_VALUE1 WHERE KEY1 = @KEY_VALUE1 IF @@error <> 0 OR @@rowcount <> 1 BE...

Optional Database Entities (part 2)

See 'Almost Decided' below NOTE: This is a continuation and simplification of Optional Database Entities. I am designing a new laboratory database that tests a wide variety of tests on a wide variety of sample types. Main Entities:   Each must have exactly one parent (except REQ) and at least one child (except MEA). Request ...

Weird OpenEdge query behaviour

We have recently had to do some work with an OpenEdge database that a third party product uses, and today (after much hair-pulling), we finally identified why a view was returning no results. This view in question combines about 100 separate tables, and is then queried against (we have limited rights to this database). One of the fields ...

Merging identical tables but maintaining separate referential integrity

Consider a dimensional model with fact tables like (fk_dim1value, fk_dim2value, ..., value) where the fk_X columns are foreign keys into corresponding trivial dimension tables dim1value (id, value), dim2value (id, value), etc. These fact-and-dimension tables are collected automatically from disparate sources, so there's a lot of them .....

Connecting to MS SQL Server 2005 from Mac using Ruby, ODBC and FreeTDS

I'm having trouble connecting to a SQL Server 2005 install from this very simple Ruby app: #!/usr/bin/env ruby require 'rubygems' require 'sequel' Sequel.odbc('dev04')['select top 1 * from users'].all The dev04 DSN points to my odbc.ini file entry: [dev04] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace =...

Database independence with NHibernate?

I understand how NHibernate separates the persistent db structure from the logic and how the mapping works, but how do you guys handle data intensive actions, complex select scenarios, data maintenance, etc? We use stored procedures for things like these and we actually have quite a few of them. Now what is the recommended practice? Is ...

Performance lost when open a db multiple times in BerkeleyDB

I'm using BerkeleyDB to develop a small app. And I have a question about opening a database multiple time in BDB. I have a large set of text ( corpus ), and I want to load a part of it to do the calculation. I have two pseudo-code (mix with python) here @1 def getCorpus(token): DB.open() DB.get(token) DB.close() @2 #ope...

Cross-platform open-source asychronous HTTP and DB with C#

Does anyone know of a good resource for open-source libraries for asynchronous C# (or native stuff to the language). I'm interested in anything on this topic, but I'm specifically looking for stuff pertaining to HTTP and DB calls. Maybe an event-driven framework with plugs for HTTP and DB? Please do not buzz in with a non-C# solution or...