database

How do I use dynamic SQL to declare a column name derived from a table name?

Building on Tony's answer on this question: If I want to do something like this, CREATE PROCEDURE A(tab IN VARCHAR2) IS tab.col_name <column> --static declaration (column name always remains the same) BEGIN EXECUTE IMMEDIATE 'INSERT INTO ' || tab(col_name) || 'VALUES(123)'; END A; How can I use Dynamic SQL in the above case? ...

Groups-People Database Design - Need advise

I'm developing an application in which users upload pictures to server and then send email to people they choose with a link that shows these pictures. My question is about organizing the people in a database (I'm using MySQL). I would like each user to have people tree like this: Family Mom Daddy Jonathan Close Friends David Ron...

How does index rebuilding happen after a table is updated?

original simple table A ------------------------ rowid id name 123 1 A 124 4 G 125 2 R 126 3 P index on A.id ------------- id rowid 1 123 2 125 3 126 4 124 updated simple table A ---------------------- rowid id name 123 1 A 124 5 G 125 2 R 126 7 P Assumin...

AD user impersonation does not propagate to database with integrated security

I have a setup where I impersonate an AD user as described here. The app connects to the (Oracle) database using integrated security, but the impersonated credentials are not propagated to the database. Are there any known issues with impersonating AD users and accessing the database with integrated security? ...

LINQ to SQL: SubmitChanges() does not work?

Here's my code var bt = new BachtuocvnDataContext(); var matchedTeams = (from lt in bt.Bet_Leagues_Teams where lt.LeagueID == leagueID select (lt)).Single(); matchedTeams.TeamID = teamID; bt.SubmitChanges(ConflictMode.ContinueOnConflict); It does not upd...

JPA Mapping Issue - Modelling direction requested

Hello, I'm having a problem modelling the following problem in JPA. I have a JPA Entity class 'User', like so: (accessors/mutators/extraneous fields/extraneous JPA configuration omitted for brevity) @Entity class User { @Id @Generated Value long id; @OneToMany Report contributorReports; ...

Storing settings inside DB

Hello, can someone tell me what's the best way to store many different settings in a database? Should I use one table with id,key,value? Here is an example what i have to store: PageNavigation.Font = "fontRegular"; PageNavigation.FontSize = 14; PageNavigation.FontColor = 0x000000; PageNavigation.SubFont = "fontRegular"; PageNavigation...

How To Save the State of Current Work?

I am working on a site that has tests users can take. I have a test area set up with 100 questions on each subject. If a user is taking a test, I want them to be able to save the work they have already done and when they return I want them to be able to continue the work from where they left. The questions being answer are multiple choic...

Easiest way to load table dump into database

I have a 71GB file having contents of one table of mysql database. Loading that takes me couple of days. Is there a easier way to load the data. I am not sure if removing indexes or splitting files actually helps. How stackoverflower's solve this problem. ...

How is a table UPDATE handled by a RDBMS?

Suppose I have a table and an index on it original simple table A ------------------------ rowid | id name 123 | 1 A 124 | 4 G 125 | 2 R 126 | 3 P index on A.id ------------- id rowid 1 123 2 125 3 126 4 124 At this point, I execute this DML statement UPDATE A SET id = 5 WHERE id = 4 What e...

SQL Server job to check 2 databases and act based on result?

I need to check 2 tables on similar databases on different servers, if they contain the same information (or size, hash, whichever is the best way to check if they're the same) then one of them should have its information deleted, on a scheduled job every day. Is this possible using only the Jobs interface from within SQL Server Managem...

Does Posgresql guarantee unique timestamps?

8-byte integers are now the default for Postgres 8.4, so it allows microsecond values to be stored. I don't care too much about real microsecond precision (probably depends on OS capabilities?!) - But does Postgres guarantee, that the timestamp values (inserted by current_timestamp) are always different between any two transactions? ...

Vaadin and JPA container, store beans or not

I'm a first-timer to this and would like to have some guidance regarding how to store objects in a database.. I have an object Person, with a couple of fields in it. I have one PersonContainer which loads all the objects from the database. What is best of these two: (or if they both suck, tell me what's the right thing to do) Store th...

Want to dynamically get images from a database and set it to CSS background

This is something I just couldn't figure out how to do in ASP.NET: I have a database of photographs, with upload/management and all that. What I want to do is to dynamically change/create a css file that changes the background of a div to one of the selected images on the database. (bing.com style). Is this possible using images store...

Reading from Linked Server and deleting on local DB

Hi, I have 2 similar tables on different databases. I already linked the remote DB and set it's data access to 'True'. However I can't get the following query to work GO USE LOCALDB GO DELETE from [dbo].[TableA] WHERE [dbo].[TableA].[UniqueField] = (SELECT [UniqueField] FROM [REMOTESERVER].[REMOTEDB].[dbo].[TableA]) GO This query d...

Taps Server Error: PGError: ERROR: duplicate key value violates unique constraint

I could not find a similar question on stackoverflow, so i apologize if its a duplicate. If its already been answered, kindly point me to that. I am moving my app from engineyard to heroku and i am trying to push the db using their db:push command. It works great until it reaches one table where it complains of violating a unique constr...

Choosing a Connection String based on kind of request

Hi all, I used to have a web service through which a client could perform DB operations and a website could read the DB. Now, due to re-design needs, through the webservice a client can make DB operations. This DB is in workstation A. Through the same webservice, a website retrieves information from DB. This DB is in workstation B. DB...

connecting database in regular interval

I have a situation where I have to check for a value in a database say aValue. If aValue is availabe then do process aValueProcess(). If the value is not available, I only can wait 30 min, and needs to check the database for value for every 10 minutes (3 times). If it exceeds 30 min exit the program. Can anybody give me the logic for th...

Simple and reliable in memory database for fast java integration tests with support for JPA

My integration tests would run much faster if I used in-memory-database instead of PostgreSQL. I use JPA (Hibernate) and I need an in-memory-database that would be easy to switch to using JPA, easy to setup, and reliable. It needs to support JPA and Hibernate (or vice verse if you will) rather extensively since I have no desire to adopt ...

JPA with Multiple Servers

I am currently working on a project that uses JPA (Toplink, currently) for its persistence. Currently, we are running a single application server, but, for redundancy, we would like to add a load balancer and another application sever (and possibly more as it grows). First, I'm running into the issue of JPA caching. Since two processes ...