database

Getting data from data warehouse into relational database

Hi This fairly unusual, but because of office politics etc. we have (read-only) access to the data warehouse, but not to the live data. However we need up-to-date data to populate our relational (OLTP) database (MS SQL server. The data in the warehouse (also MS) is in star schema format (i.e. Dimensions and Facts). I am not very familia...

What are standard/best practices for creating unit tests for functionality using databases?

I get the idea behind unit testing however am trying to think of a clean simple way do it when it requires database functionality. For instance I have a function that return result based off a database select query. Would the database alway have to remain the same for me to properly see that only the correct results are being returned....

multiple sqltransactions in single sqlconnection

I have some code that I want to execute as follows. But I keep getting the exception "This SqlTransaction has completed; it is no longer usable" on the 2nd iteration. Could someone help me point out what I am doing wrong here? Thanks! SqlConnection cn = (SqlConnection)SqlConnectionManager.Instance.GetUserConnection(user); cn.Open()...

How to Develop TSQL in Visual Studio 2010 Database Projects

Silly sounding question, I know... Let me lay some groundwork first. I have successfully created a database project comprised of the hundreds of tables, stored procedures, indexes, et.al. that make up our production database. I have successfully added the solution to source control (TFS). I have made a change (as a test) to some of th...

MySQL Query Help

Heh guys, I need help with a MySQL Query. The Output of the query should look like this User1 User2 xxx1 xxx2 xxx3 xxx1 but not User1 User2 xxx1 xxx2 xxx2 xxx1 and so on. I need all "friendships" between different users. A friendship exists i.e. when UserId 8 exists in Column User1_id Us...

Data Synchronization

Hi guys Our group is annotating some videos, finding the hands' location in a video. We store the annotation results in txt files. The problem is that everyone annotates different videos. Every time, I have to merge their annotation files. My idea is I build bunch of txt files which correspond to our videos(one video corresponds to one ...

Websites and Database Views

What are the security implications of websites accessing database views instead of using stored procedures? The views in question are only being read from; not written to. Edit The applications in question are ASP.Net MVC 2 using the Entity Framework (v.4). ...

ASP.NET Routing - Route Constraint with database lookup

I'm just starting out with C# and ASP.NET and have the following questions. I am working with code adapted from a couple different tutorials playing with Northwind and have gotten this far. The list of acceptable categories is currently hard coded in a string but I would like to look up the CategoryName in the database to verify that i...

MySQL: Pivot + Counting

I need help with a SQL that will convert this table: =================== | Id | FK | Status| =================== | 1 | A | 100 | | 2 | A | 101 | | 3 | B | 100 | | 4 | B | 101 | | 5 | C | 100 | | 6 | C | 101 | | 7 | A | 102 | | 8 | A | 102 | | 9 | B | 102 | | 10 | B | 102 | =================== to ...

How can I optimize a query that does an ORDER BY on a derived column in MySQL?

I am having trouble optimizing a relatively simple query involving a GROUP BY, ORDER BY, and LIMIT. The table has just over 300,000 records. Here's the schema (I added some extra indexes to experiment with): CREATE TABLE `scrape_search_results` ( `id` int(11) NOT NULL auto_increment, `creative_id` int(11) NOT NULL, `url_id` int(...

JPA - create-if-not-exists entity?

I have several mapped objects in my JPA / Hibernate application. On the network I receive packets that represent updates to these objects, or may in fact represent new objects entirely. I'd like to write a method like <T> T getOrCreate(Class<T> klass, Object primaryKey) that returns an object of the provided class if one exists in ...

Android thinks I'm not closing my database! Why?

I have a SQLiteDatabase data member that I initialize in onCreate and call .close() on in onPause(), onStop(), and onDestroy(). It is re-initialized in onResume(). It seems to run just fine but when I looked at the debugger it see this: 08-24 20:23:50.014: ERROR/Database(6767): Leak found 08-24 20:23:50.014: ERROR/Database(6767): java.l...

selecting previous and next rows in mysql - how?

I can't figure out how to select a previous/next row IF the current row does not have any numeric identifiers. With numeric value I always use 2 queries: SELECT min(customer_id) FROM customers WHERE `customer_id` < 10 GROUP BY customer_status ORDER BY customer_name ASC LIMIT 1; SELECT max(customer_id) FROM custo...

I'm building an app that requires Data Integration with customer's database

I'm in the process of designing an application that would tie into the database for multiple e-commerce stores. I have the general business logic down but the problem is, I have no idea on the most painfree and effective way to do the data integration. I know how to access my own databases, but this is something I always just left to m...

Why is the record not showing up in the DB

i am trying to create a custom solution for a client using their prior system. The client is using Miva which is a user friendly CMS type system to manage their store. The problem is prior to yesterday everytime i entered a record in the miva site it would show up in PHPmyadmin and I could query it and use the Custom solution. FOr some r...

Installable search engine package for file search

Currently there exist package like gonzui (example of the implementation here) for doing source code search. Is there a similar package that does the same thing except for simple file search. Basically I have two list of files for file type A and file type B. When the user type a word in the search box, all files (in "gz" format) wit...

java get duration from database

table structure: sysdurationtimeday , sysdurationtimehour, sysdurationtimeminute 1, 12,10 3, 23,10 0, 0,10 i have these 3 fields from database, after getting these 3 values, what is the technique that i can use do cast to which Java Object? (maybe Calendar.class, TimeStamp.class) ? and use it to compared with record is spent less th...

Databases for easy comparison

We have an application which has metadata information stored in database (some tables with relations between). The metadata can be edited through web app or directly manipulating values in SQL Server database. The problem: metadata changes and needs to be merged between different environments (test, staging, production, etc.). There ar...

How reliable is master-slave replication?

I was watching this screencast at RailsLab where the presenter claims that it's possible to have a master DB for write operations and a slave DB for read operations. While for certain types of Web sites (e.g. blogs, social networks, Web 2.0 sites, etc.) it is acceptable for the master and slave DBs not to be 100% synchronized for short p...

Random exception android.database.sqlite.SQLiteException: unable to open database file

My app uses a uncaught exception handler that sends the stack trace to me when the app crashes. Often I get this report from random users. I cannot replicate it, the opening of the database always succeeds in my case. This is not a database stored on external SD card, only a database opened with SQLiteOpenHelper(context, "SomeName", nu...