mysql

About hibernate NamedNativeQuery

Hello, I am a newbie in hibernate, I am using @javax.persistence.NamedNativeQuery to resolve my stored proc calls from hibernate to mysql but i am getting errors. Please help: My persistent class is: @Entity @javax.persistence.NamedNativeQuery(name = "SampleNameQuery", query = "call spS_NamedQuery(?,?)", resultClass = NamedQuery....

Ajax doesn't work in iPhone safari

My ajax works fine in firefox but it does not work on my iPhone. I thought it might have been the XMLHttpRequest but that doesn't seem to be the issue. I am for sure it's not my php script. Sorry that I didn't post it earlier. It was really hard to post on iPhone, especially since I can't scroll down to highlight all the code Here is my...

Multiple MySQL queries with Ruby

Hi, I'm having troubles with MySQL queries in Ruby. I use 'mysql' gem. Configuration is stored in a separate yml file and loaded into @conf variable. This is my code: # connect to the database Mysql::new(@conf['sql_host'], @conf['sql_user'], @conf['sql_password'], @conf['sql_base']) # it's ok when we're doing this my.query("SELECT * ...

How to ORDER BY based on two different columns

I have a table with 5 columns. When I list the table, I want to order by one column so that the types are grouped together and then order them alphabetical so that they are easy to find. Is it possible to ORDER by two different columns? Here is my current select: $query_rs_cms = "SELECT * FROM games ORDER BY type ASC"; I guess wha...

Is InnoDB sorting really THAT slow?

I had all my tables in myISAM but the table level locking was starting to kill me when I had long running update jobs. I converted my primary tables over to InnoDB and now many of my queries are taking over 1 minute to complete where they were nearly instantaneous on myISAM. They are usually stuck in the Sorting result step. Did I do som...

Best Practices: Tracking Banner Impressions

I am writing a banner ad engine in php/mysql. I don't want to use OpenX or a turn-key solution because there is going to be a bunch of custom functionality that I would rather not rely upon an existing system to have to flex to accommodate. Here is the thinking and my current approaches to the impressions architecture: Requests to ban...

Why would MySQL leave out the first row when retrieving from a database?

For some reason I'm having a problem retrieving data from my database. It leaves off the first item being listed. Connection: mysql_select_db($database_my_db, $my_db); $query_rs_jobboards11 = "SELECT * FROM jobBoardsSpecTypes ORDER BY type"; $rs_jobboards11 = mysql_query($query_rs_jobboards11, $my_db) or die(mysql_error());...

How to protect HTML navigation

Hi! I am writing software for an elearning platform. Validation is performed via PHP and MySQL. All content is uploaded into a folder protected for all direct access by HTACCESS and content is only served to users via a PHP routine that validates student credentials and then Fopens the file and sends it to the browser. This is ok for a...

simpledb, sql azure, mysql + memcached

For a new scalable high traffic global ecommerce website (asp.net) project which technology fits best (max. scalability & performance, min. price & maintenance)? amazon simpledb, microsoft sql azure, mysql + memcached combo, or your solution... ...

(My)SQL - batch update

Hey, I have a table with "id", "name", and "weight" columns. Weight is an unsigned small int. I have a page that displays items ordered by "weight ASC". It'll use drag-n-drop, and once the order is changed, will pass out a comma-separated string of ids (in the new order). Let's say there's 10 items in that table. Here's what I have so ...

Combining SUM and AVG with GROUP BY in MySQL

I'm not sure if this is going to be possible in a single query, but I'm trying to achieve the following with MySQL and haven't yet found a solution. I have a table that is structured a little like this: ID LOG_VALUE LOG_TIME 1 5000 19:05:42 2 6205 19:05:45 3 1000 19:05:40 1 ...

Mysql select grouping

I have two tables I need to select data from TABLE_A and TABLE_B; they have a one to many relationship. In my select statement I will often get multiple unique results from TABLE_A and this is fine. But I will also get multiple matches in TABLE_B - I need to get the most recent TABLE_B record that matches. I have an auto incremented id ...

Dynamic Column name in MYSQL

Yesterday I screwed up by asking question which had dupe column name by accident. This caused interesting solutions. So I will ask same question here again, but this time I will directly mysql dump, so there are no confusion. CREATE TABLE `tbl1` ( `UserID` char(15) DEFAULT NULL, `col1` char(15) DEFAULT NULL, `col2` char(15) DEFAUL...

Setting up Sphinx

Hehe, don't laugh at me, just trying to set up Sphinx on my local WAMP, I haven't done this before so I'm probably doing something silly. This is my sphinx.conf file: source code { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = **** sql_port = 3306 sql_query = SELECT id, language_id, c...

Why only one record after union?

mysql> select count(id) total from applicants; +-------+ | total | +-------+ | 0 | +-------+ 1 row in set (0.00 sec) mysql> select count(id) total from jobs; +-------+ | total | +-------+ | 0 | +-------+ 1 row in set (0.00 sec) mysql> select count(id) total from applicants union select count(id) total from jobs; +-------+ | tot...

Sql query to alter table

I have two tables miusernames with columns where UserNamesID is the primary key for table miusernames.. UserNamesID UserName 1 senthil 2 robert and miemailids with columns where Emailid is the primary key for table miemailids .. Emailid UserNamesID 1 2 I forgot to create...

Why do reads block other reads in MyISAM?

I have one really long running read. It is a cronjob run once a day, but the whole DB gets locked down when it is running : mysql> show full processlist; +--------+------+-----------+------+---------+------+--------------+--------------------------------------------------------------------------------------------------------------------...

How do I check if my mysql database causes slow down

I have around 3 websites residing in a server which is being shared with other teams. I have been notified that there is a huge increase in CPU usage and we need to lower it down. I doubt my websites are causing this. I have been using SHOW FULL PROCESSLIST in MySQL and 90% of the time shows queries from other databases. But I think ex...

Binary file size

I have added the following option in order to avoid having smaller multiple binary files. max_binlog_size=1024M But MySQL still does not create a huge binary file as expected. How do I make it create a single file instead of multiple small files? ...

Joining with subqueries, counting and grouping.

Hello everyone, I have 3 tables, which are each 1:n. an entry in table1 has n entries in table2, and so on. lets call them cars, wheels, and screws for illustration. Screws can be clean(1) or rusty(2) I am joining them together, because I want to count 2 things. First, I want to have rows telling me how many good/bad screws per whee...