database

Should a Composite Primary Key be clustered in SQL Server?

Consider this example table (assuming SQL Server 2005): create table product_bill_of_materials ( parent_product_id int not null, child_product_id int not null, quantity int not null ) I'm considering a composite primary key containing the two product_id columns (I'll definitely want a unique constraint) as opposed to a sep...

What is easiest way to transfer tables between MSSQL databases without a network connection?

I have a small app/site on a dev server with a data table in SQL Server [varchar(40),varchar(40),varchar(MAX)]. I want to take the data table and push it to the live server. I have tried exporting in txt, Excel and Access but every time there is an error on import related to not being able to parse due to the data in the varchar(MAX) fie...

C# Windows Application - Many threads using the same connection?

I've got a c# WINDOWS Application that is multi-threaded. It is my understanding that in a web environment, connections are pooled automatically. It is also my understanding that in a Windows app, this is not the case. Therefore, for a Windows app, the same connection should be used and not closed after each call, but instead closed when...

DataBinding with a DataGridView C#

I have a Database table that I want to display in a DataGridView. However, it has several foreign keys and I don't want to show the integer that represents the other Table to the user. I have this DataTable with a column userId I have another DataTable with a column id, and a column username I want the DataGridView to show the username...

Database schema design

I'm quite new to database design and have some questions about best practices and would really like to learn. I am designing a database schema, I have a good idea of the requirements and now its a matter of getting it into black and white. In this pseudo-database-layout, I have a table of customers, table of orders and table of products...

How do you typically import data from a spreadsheet to multiple database columns?

For whatever reason, I have a lot of clients that have existing data that's stored in spreadsheets. Often there are hundreds, if not thousands of items in each spreadsheet, and asking the client to manually enter them through a website (or heaven forbid importing them that way myself) is out of the question. Typically, this data doesn't ...

MySQL failover using MySQL Proxy

Hi, I'm looking at implementing a failover mechanism for a MySQL database using MySQL Proxy (http://forge.mysql.com/wiki/MySQL_Proxy) My proposed setup is as follows: One active MySQL server and one passive MySQL with two way replication enabled between the both of them. MySQL Proxy is the failover that sits in between these two server...

What is the best code location to define table relationship methods using Zend Framework models?

I'm creating a simple tag system that allows me to link a tag to almost everything in my application. In order to facilitate this, I created a table called "objects", referenced by my model "Object". I've got three models setup at the moment: Tag (with TagObject defined as a dependentTable) Object (with TagObject defined as a depended...

Update in Oracle

I need to update the comments field in a table for a large list of customer_ids. The comment needs to be updated to include the existing comment and appending some text and the password which is in another table. I'm not quite sure how to do this. Here is some code that does this for a single customer id. How would I go about doing t...

How to query SQL Server table based on a specific date

I have a table in SQL Server 2005 which has three columns: id (int), message (text), timestamp (datetime) There is an index on timestamp and id. I am interested in doing a query which retrieves all messages for a given date, say '12/20/2008'. However I know that simply doing where timestamp='12/20/2008' won't give me the correct r...

Can RowSets be used with PreparedStatements?

I have just found RowSets for database querying with JDBC. They are stateless and cacheable, they look to be superior to ResultSets. Can PreparedStatements be used with them though? PreparedStatements are a performance booster for querying very large databases, and not something I would want to give up (before something is said, this is ...

Versioned RDF store

Let me try rephrasing this: I am looking for a robust RDF store or library with the following features: Named graphs, or some other form of reification. Version tracking (probably at the named graph level). Privacy between groups of users, either at named graph or triple level. Human-readable data input and output, e.g. TriG parser an...

Preserving relational integrity with Mnesia

I've been diving into Erlang recently, and I decided to use Mnesia to do my database work given it can store any kind of Erlang data structure without a problem, scale with ease, be used with list comprehensions, etc. Coming from standard SQL databases, most rows can and should be identified by a primary key, usually an auto-incrementin...

Exposing database IDs - security risk?

I've heard that exposing database IDs (in URLs, for example) is a security risk, but I'm having trouble understanding why. Any opinions or links on why it's a risk, or why it isn't? EDIT: of course the access is scoped, e.g. if you can't see resource foo?id=123 you'll get an error page. Otherwise the URL itself should be secret. EDIT:...

Python-PostgreSQL psycopg2 interface --> executemany

Hi again, I am currently analyzing a wikipedia dump file; I am extracting a bunch of data from it using python and persisting it into a PostgreSQL db. I am always trying to make things go faster for this file is huge (18GB). In order to interface with PostgreSQL, I am using psycopg2, but this module seems to mimic many other such DBAPIs...

IBM.Data.DB2

Can I develop a windows application using .NET framework and IBM.Data.DB2 provider to access a DB2 database running on OS/390? Thanks in advance. ...

Best way to store multi-dimensional array on a server?

I'm developing a web-based, turn-based strategy game which takes place on a 10x10 board. Each tile represents an area of land and has its own set of statistics (eg, income, population, fertility, natural resources). Each time the client loads it will download all of the information for the game (ie, loading the stats of only one tile i...

Database design question

I accumulated a quite a lot of data in a raw form (csv and binary) - 4GB per day for a few months to be precise. I decided to join the civilized world and use database to access the data and I wondered what would be the correct layout; the format is quite simple: a few rows for every time tick (bid, ask, timestamp, etc.) x up to 0.5Mill...

GUI Programming. Database and Tables syncronization

I've worked on several desktop applications that used tables to group information from a database table. But keeping this information updated has made me hack different solutions like a working thread that updates a table executing a query every X seconds, or simply a button to refresh the view. I have even seen an app that would refresh...

Creating ADO.NET mapping for custom type

I have a custom type that I created, which should be persisted in a database (in this case, SQL server) as a guid (though this question is just as valid for an object that could be stored as a string, integer, etc). When I pass this type as a parameter to a DbCommand object, I get an exception: ArgumentException: No mapping exists ...