database

Insert and Retrieve data at same time

Hello, We are doing backup/restore functionality on base of one Entity. so let's say system is doing restore for Entity 1 (which is 1 million rows), now at the same time User's of Entity 2 needs to Retrieve or insert a data in the same table. Note: Table can contains rows of multiple Entity. I want to implement something so that if ...

RowGuide and UNIQUE KEY

Hi, i need a GUID at row level in my table (name column RowGuid) datatype is uniqueIdentifier. Do I need also state it as a UNIQUE KEY (alternate key)? Ex: RowGuid uniqueIdentifier UNIQUE KEY Thanks ...

Most efficient (for reads) way of modelling a One to Many relationship with EF4

This is a fairly simple question (or at least from the outset it should be). I am looking into efficient ways to model a One to Many relationship where the many is the same type. Example Say we have a Person Entity, and this person has 0 to many Sub-Persons, and the Sub-Persons have 0 or 1 Parent-Person. The answer should take into c...

Cannot save characters of my language

Hi, I am trying to save some data(name, last name) in my forms with php and mysql. It's simple form like: <input type='text' name='first_name' /> And php gets it after submiting with: $first_name = trim(mysql_prep($_POST['first_name'])); The problem is, that if I type characters in my languege(lithuanian), it won't save them and w...

How to insert date and time with fractional seconds in Oracle?

I'm using oracle 11g. I'm inserting date and time using function SYSDATE into column with type TIMESTAMP. But fractional seconds always are 0. How can I insert date and time of database server with fractional seconds? Is there any functions? ...

When designing websites, what are my options for data storage?

I am a website designer, and I design both sites and applications for the web. I use PHP. I often find I have to store information, which needs to be accessed by the user after the browser is closed. Up until now I have always used a database (MySQL to be precise) to store information, however sometimes, I feel that I am storing info...

Managing an Android database

I'm looking to implement my first Android database, but I have so many questions which (I believe) are unanswered by all the tutorials I find. Here are my needs: - I want my application to have a database that is persistent. If my application closes and launches again, there is already a database to pull data from. It does not create ...

In what cases would or wouldn't you use database triggers instead of a script called by cron?

A fully normalized database with no redundant data is good "academically", but has terrible real-world performance. The first optimization is obviously a cache system. After this, for creating redundant data for performance, when or why would (or wouldn't) you use triggers over a cron task that calls a script to update the redundant dat...

Problem during SQL Bulk Load

Hi there, we've got a real confusing problem. We're trying to test an SQL Bulk Load using a little app we've written that passes in the datafile XML, the schema, and the SQL database connection string. It's very simple (the program is five lines, more or less) but we're getting the following error from the library we're passing this stuf...

SQL - create database and tables in one script

Sorry if already asked, but I can't find anything on this. I am moving something over from MySQL to SQL Server I want to have a .sql file create a database and tables within the database. After working out syntax kinks I have gotten the files to work (almost). If I run IF db_id('dbname') IS NULL CREATE DATABASE dbname it works ...

Access on NHibernate: slowness ?

Hi, I'm using NHibernate and Microsoft Access. My database file is fairly large ( ~500 MB ) and my app. is slow when writing to the database and I was wondering if any of you have experience with NHibernate and large Access databases. I want to know if this slowness in the app. is an known issue. Regards, MadSeb P.S I did "compact a...

SQLyog question

I'm using SQLyog and I used to Database Synchronization Wizard to make a job (which I saved, and it saved it as an xml file). However, the job doesn't show up in the Job Manager. How do I make this happen? ...

Case insensitive search in database with an index?

I'm using Postgres. I have a table of Artices in my database, with a column url for url slugs. These are so that I can display the articles in that table on a website as not "example.com/23323" but instead as "example.com/Funny_Thing_Happened_to_Me". This was straightforward enough to implement, and then as the number of articles grew, ...

Unique constraint within a group of records where some value is the same

DBMS: MS Sql Server 2005, Standard I'd like to make a table constraint to have only one record have a particular value within a subset of the table (where the rows share a value in a particular column). Is this possible? Example: I have records in myTable which have a non-unique foreign key (fk1), and a bit column called isPrimary to ...

What for sturtup to start with: complex systems (requiring big resourses) or simple and rewrite later for scalability or own "middle" solution?

Well, I've been searching for good DB solution for my startup idea. I won't create one more topic "Which DB is the best ever?!", but I'll ask one other thing. So, I haven't found any good horizontal-scalable DB written in C++. Why C++? Of course, there are Cassandra if you need document-store and Voldemort if you need key-value storage....

export mysql data to csv file

Hi, I am trying to do 2 output data from mysql to a csv file. My code is as follows: public void exportData(Connection conn,String filename) { Statement stmt; String query; try { stmt = conn.createStatement(); //For comma separated file query = "SELECT * into OUTFILE '/tmp/input.csv'...

Object-oriented / Relational-Hybrid Database?

I've been using relational databases + object relational mappers for object persistence. I don't think this is a truly adequate solution for persistence, because it adds unnecessary overhead. It also forces me to fit objects in a table-like structure, which sometimes can't be done gracefully - it's like fitting a square in a circle - it...

How do I get a non-null SCOPE_IDENTITY when using INSTEAD OF triggers in SQL Server 2008?

Possible Duplicate: Instead of trigger in SQL Server - looses SCOPE_IDENTITY? On SQL Server 2008, I have an INSTEAD OF trigger on a view. The SCOPE_IDENTITY() after the trigger is results in null. This causes problems with the libraries we're using. How can I control SCOPE_IDENTITY from within my trigger? This is absolutely n...

SQL 2008 - resultset order issue

We are using SQL Server 2008. We have a table called response which has a primary key called response_id. It also has a column called bid_id. When we execute the query ‘select * from response where bid_id = x’ without an ‘order by’ we are getting results in mostly ascending order (default), but once in a while in descending order (ve...

Weakly typed LINQ to Relational Data

Strong typing is fine and dandy when you know what your schema is going to look like at compile time. But what if you're working on an application that lets the user define their own schema? Is there a reliable relational LINQ provider out there that operates at the same level of abstraction as LINQ to XML? Example: var whoIsJohnGalt ...