mysql

MySQL query over many-to-many realtion: unions?

In addition to this question http://stackoverflow.com/questions/1202668/problem-with-sql-query which had very neat solution, I was wondering how the next step would look: DOCUMENT_ID | TAG ---------------------------- 1 | tag1 1 | tag2 1 | tag3 2 | tag2 3 | tag1 3 ...

Bitwise operators in Postgres

I have a problem with using Bitwise operators in Postgres I get the following error message ERROR: argument of WHERE must be type boolean, not type integer My query looks as below SELECT DISTINCT number,name,contact,special FROM clients WHERE special & 2048; Any help will be appreciated ...

How can I optimise this MySQL query?

I am using the following MySQL query in a PHP script on a database that contains over 370,000,000 (yes, three hundred and seventy million) rows. I know that it is extremely resource intensive and it takes ages to run this one query. Does anyone know how I can either optimise the query or get the information in another way that's quicker?...

Getting duplicate entry errors from Hibernate, is MySQL to blame?

I am working on a database application which is mostly read-only, but there is one table which records user movement in the app and has a large number of writes to it. For every few thousand writes, we see a few exceptions in the error log like so: [WARN][2009-07-30 11:09:20,083][org.hibernate.util.JDBCExceptionReporter] SQL Error: 106...

Error during connection to MySQL with C#

HI all, I am trying to connect mysql to windows following the instructions given in http://www.dscripts.net/tutorials/2009/01/18/connect-to-mysql-database-using-csharp/ I have installed mysql 5.1 software,gui tools and mysql connector. Mysql is working fine. I want to establish connection b/w mysql database & c# windows application. ...

Return Cursor from Stored Procedure

How can I return a cursor from stored procedure in MySQL? ...

Update query on linked MySQL table from SQL Server

I have a MS SQL Server with a linked MySQL server. I need to partially synchronize a table between the two servers. This is done in three steps and based on a condition: Delete all rows from the MySQL table that do not satisfy the condition Insert all new rows in the MySQL table that satisfy the condition Update all rows in the MySQL s...

What are the pitfalls and solutions when setting up Rails/Mysql on Leopard?

Hi there, I've been going stir crazy trying to install the ruby mysql gem here, and I'm writing here so if anyone else is in this ridiculous situation, they don't have to go through the same pain as me. What are the common gotchas when installing the mysql gem onto a fresh copy of Leopard? In this case, I'm using Leopard - OS 10.5....

PHP/MySQL: Best way to fetch new entries?

We've got some kind of groups at our site where group members could put messages. I want to notice the members of each group when there's new entries. What's the best way to do this? ...

MySQL Error number 150 Create Fails on non existent foreign key

I was wrestling with mysql administrator trying to change the primary key on a table. It wouldnt let me so I delete foureign keys and rename the table, great no problem. I have now deleted the original table t_order_items but I cannot rename t_order_items2 to t_order_items, it fails with a 150 error. SO i figured I would craft up the ...

ruby on rails remote database connection MySQL The 'InnoDB' feature is disabled error

I am attempting to remotely connect to a MySQL database using ruby on rails. In my database.yml: development: adapter: mysql database: peer host: host port: 3306 username: root password: password I then go to do a rake db:migrate and get this error Mysql::Error: The 'InnoDB' feature is disabled; you need MySQL built with 'Inno...

MySQL / PHP: Date functions for page view statistics and popularity...

Hi, I have a table with number of page views per day. Something like this: +------+------------+------+ | id | date | hits | +------+------------+------+ | 4876 | 2009-07-14 | 4362 | +------+------------+------+ | 4876 | 2009-07-15 | 1324 | +------+------------+------+ | 7653 | 2009-06-09 | 5643 | +------+------------+------+ ...

Mysql Datevalue()=Date()

I'm trying to split a table in two views depending on whether the field "Date" is today or not. I have tried using WHERE DATEVALUE(table.Date)=DATE(), but I get an error at saving saying that the last ) has wrong syntax. I tried adding a group by, but apparently everything after the ) gives me the same message about wrong syntax) Am I ty...

generating unique combinations without running out of memory in php

I am writing an algorithm to generate combinations of items from a database. They need to be unique permutations (i.e. 145, 156 == 156, 145). The problem I am running into is how to keep track of previous combinations so that i do not end up with 145, 156 and 156, 145. Currently I am adding them to an array with index of id1_id2... (so...

"193: %1 is not a valid Win32 application" bug with a new Rails Application

I have a new rails application which I have created under Windows 7 by going into a directory and typing "rails newapp". The creation went fine, and when I access the root page, all is well. However, when I try to access a page that would access the database, I get this: 193: %1 is not a valid Win32 application. In the developer.log. ...

Optimal number of connections in connection pool

Currently we are using 4 cpu windows box with 8gb RAM with MySQL 5.x installed on same box. We are using Weblogic application server for our application. We are targeting for 200 concurrent users for our application (Obviously not for same module/screen). So what is optimal number of connections should we configured in connection pool (m...

Looping through mysql_fetch_array in PHP

So I have the following: $i = 0; $records = mysql_num_rows($sections_query); $row_sections = mysql_fetch_array($sections_query); foreach ($row_sections as $value) { echo $value . "<br />"; } The value of $records becomes 4 after execution and the DB has 2 columns per row. The first column value is 'section_id' and the second ...

JavaScript Date Object's month index begins with 0!

My goal is to convert a timestamp from MySQL into a JavaScript Date object in an efficient manner. Here is my current snippet that converts the MySQL timestamp into a formatted date in PHP: <?php // formats timestamp into following format: 2009, 7, 30 $date = date("Y, n, j", strtotime($row["date"])); ?> I am then using this $date va...

mysqlclient on shared server

how do i install libmysqlclient.so on ubuntu ...

Is there anything terrible about setting ft_min_word_len=2 for MySQL FULLTEXT searches?

In order to do FULLTEXT searches on 2-letter phrases such as "PR Manager" and "MS Word", I have added *ft_min_word_len=2* to the MySQL config file (/etc/mysql/my.cnf). Is there anything particularly wrong with doing this? Will it reduce performance? Will it prevent scaling to large datasets? Any comments would be appreciated. ...