database

Mysql IF THEN SET

I have a table with *PwdSettings that has a value of -50 (which is say 50 days) *PwdDate (which is the date last updated) *ExpDate (which is 0 or 1, if Password is old i need it set to 1) Im trying to write a query to say "IF PwdDate is < PwdSettings Then SET ExpDate = 1" Here is what I have tried so far, everything throws an error...

data model and app logic question?

basically i have this problem i have a table of posts(in my mysql database) Post{user_id, post, vote_up(int), vote_down(int)} because users log in, then they get to vote, but i wanted to check if the user has already voted, so then i can not allow them to vote again, and obviously im going to be using user session to control this oppo...

Hypothetical performance yield to not using SELECT *

To preface, I'm aware (as should you!) that using SELECT * in production is bad, but I was maintaining a script written by someone else. And, I'm also aware that this question is low on specifics... But hypothetical scenario. Let's say I have a script that selects everything from a table of 20 fields. Let's say typical customer informat...

Connecting Java Applet with Database

I've got a simple problem... I've got an Java applet running on my client machine which needs to communicate with a database at my end. I'm not sure how I go about it. There are numerous problems such as untrusted applet coming up. Please point me in the right direction. Thanks in advance. ...

problem with WHERE clause matching on Arabic string

I have a SQL Server 2005 database in which I have some tables contain Arabic text. The datatype for those fields is NVARCHAR(n). The Arabic text inside the table is appearing properly, and when selecting, they appear properly. Th problem is that searching for Arabic text results in 0 rows. select * from table_name where name='arabic_...

Automatically sharding MySQL?

Right now, I'm dealing with a TON (trust me) of data that needs to be available in real-time for fast reads and writes to customers. The backend storage system that we're using is Oracle, but we'd like to replace our big, beefy machines with a leaner system. For various reasons, we can't use Cassandra, and we're testing (but I'm scared...

MySQL greatest-n-per-group trouble

Hey everyone. I believe this is a 'greatest-n-per-group' question but even after looking at several questions on StackOverflow, I'm unsure how to apply this to my situation... I'm using a MySQL database and have a basic blog-type system set up about Computer Applications... The tables look like this: POSTS post_id post_created post_t...

Upload image into database using php

Hi, i am trying to upload image into database using php, i got an error message saying Undefined index: horse_image here is the form code: <form method="post" enctype="multipart/form-data"action="newhorse.php" OnSubmit="return VerifyDataEntry(this)"> <p>Please type the horse details below <p>Horse Id: <input type="text" name="horse_...

Why is my SQL database marked readonly?

hi, i usually have my database updated in my development machine. I need to transfer it to the client using some media like cd, dvd, pendrive or other. When the client copies it and attaches it in his computer it shows readonly format and no transaction is allowed. I don't know what i am missing to make it work? Steps i follow: 1.)...

Database to save & retrieve names in android application

Hi All, I need to fill in edit boxes with first and last name...i want dabatabase which saves these once i fill the edit boxes and teh nxt tym i enter a single cahracter it shoud retrieve that name...Plz provide code to me .Thnx in Ad:) ...

How does createStatement/executeQuery/next work ?

Given the following example (supposed to be correct JDBC, but I'm noob): Connection conn = getConnection(); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT NAME FROM USERS"); while(rs.next()) { string name = rs.getString("NAME"); //... } At what point is NAME information transferred from the da...

C Custom Database writing errors

I have an assignment for class that I have to write a program to read and write key, value pairs to disk. I am using a linked list to store the keys, and read in values whenever I need to from disk. However, I am having trouble changing and deleting values. I am using this to test it: http://gaming.jhu.edu/~phf/2010/fall/cs120/src/sdbm-e...

Transactional And Reporting Databases - How?

When building a transactional system that has a highly normalized DB, running reporting style queries, or even queries to display data on a UI can involve several joins, which in a data heavy scenario can and usually does, impact performance. Joins are expensive. Often, the guidance espoused is that you should never run these queries of...

Can commits be automatically collected into a batch?

Is there a way to automatically put multiple updates into batches? For example, transform this program: PreparedStatement prepStmt = con.prepareStatement("UPDATE DEPT SET MGRNO=? WHERE DEPTNO=?"); prepStmt.setString(1,mgrnum1); prepStmt.setString(2,deptnum1); prepStmt.executeUpdate(); ...

How to handle multiple database schema creation scripts with Maven?

I have an application in development that supports several databases including SQL*Server 2008, Oracle 10G, Oracle 11G, MYSQL 5, etc. Already within Maven I have done three things: 1) There is a profile for each database so that the system can use it for integration testing during the build. 2) Maven invokes the hibernate3 plugin to ...

PHP and Database Output . Lockup during one method but not the other.

I have noticed on my little web server that if a user clicks a link while my php script is outputting data from a database that the web site seems to lock up for a while and the server log shows that "Maximum execution time of 30 seconds exceeded in" etc etc. If I create a big string and output that is does not seem to happen but im gues...

Logical Model versus Domain Model

I am not a database guy. My understanding of data modelling is not extensive. From that limited understanding the logical data model is an abstraction of the physical data model, not containing anything specific to the specific storage product/medium. The logical data modelling does appear to involve business subject matter experts in th...

Copying data from one database field to another database field

I am a bit in a pitch here. We have got a development environment and a sat environment for our oracle databases. Here is what I want to achieve. I want to copy data from an x number of columns of my dev. environment to the same x number of columns of my sat enviroment. I've already tried some stuff and have created a couple of function...

When is preferred to use a standard index instead of a background index in MongoDB?

MongoDB 1.6 allows to define indexes to be run as background operations. Background indexes seems to be a little slower, but doesn't block other write/read operations so they seems to be the best choice when you need to create indexes on databases already populated with some data. However, even with empty collections, background indexes...

What are the pros and cons of having history tables?

WHAT is the better practice?: Keep history records in a separate history table Keep history records in the active table with different status? In my opinion I rather to keep a separate table to avoid creating one huge table with duplicate records which may cause unwanted lag time when querying the table. ...