mysql

Cannot insert non latin symbols in MySQL

I'm writing web-app using MySQL version 5.1.45, Tomcat 5.5.28 and Hibernate 3 When I'm trying to save string that contains non-latin characters (for example Упячка) error occurs: 1589 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1366, SQLState: HY000 1589 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Inco...

Problem with WHERE columnName = Data in MySQL query in C#

I have a C# webservice on a Windows Server that I am interfacing with on a linux server with PHP. The PHP grabs information from the database and then the page offers a "more information" button which then calls the webservice and passes in the name field of the record as a parameter. So i am using a WHERE statement in my query so I on...

Generating a set of files containing dumps of individual tables in a way that guarantees database consistency

I'd like to dump a MySQL database in such a way that a file is created for the definition of each table, and another file is created for the data in each table. I'd like this to be done in a way that guarantees database integrity by locking the entire database for the duration of the dump. What is the best way to do this? Similarly, w...

mysql innodb:innodb_flush_method

in the following link http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_flush_method it says:Different values of this variable can have a marked effect on InnoDB performance. For example, on some systems where InnoDB data and log files are located on a SAN, it has been found that setting innodb_flush_method to...

How to implement filter system in SQL?

Right now I am planning to add a filter system to my site. Examples: (ID=apple, COLOR=red, TASTE=sweet, ORIGIN=US) (ID=mango, COLOR=yellow, TASTE=sweet, ORIGIN=MEXICO) (ID=banana, COLOR=yellow, TASTE=bitter-sweet, ORIGIN=US) so now I am interested in doing the following: SELECT ID FROM thisTable WHERE COLOR='yellow' AND TASTE='SWEET'...

Increment a database field by 1

With MySQL, if I have a field, of say logins, how would I go about updating that field by 1 within a sql command? I'm trying to create an INSERT query, that creates firstName, lastName and logins. However if the combination of firstName and lastName already exists, increment the logins by 1. so the table might look like this.. firstN...

How to make Php application running on Xampp to connect to a remote mysql db?

I have a php application running on XAMPP but I want to connect to a mysql db running on a remote machine(which is also using XAMPP). The application works fine when I connect to the mysqldb instance on my machine. I have changed the configuration files to point to the remote db and have given the correct credentials as well. But I get a...

SQL Server 2008 and MySQL Daily Backups

Is there a quick and easy way to backup both SQL Server 2008 and MySQL, all their databases? Right now I have a batch script that runs, but I have to manually add a database each and every time, and I'm sick of maintaining it. So I want to set it up to backup all SQL Server and then all MySQL, I dont care if its two different solutions,...

How to create script with Insert statement for the records selected in MySql ??

Hello, I need to create a script file with the Insert statements for the records I select in the mysql table. For Instance, when i do Select * from emp where empid = 5, and say i get 10 records as result. Now I should create a script file with the insert statements of that 10 records to emp table. I am using C# as code behind... How?...

Deleting rows with MySQL LEFT JOIN

Hello! I have two tables, one for job deadlines, one for describe a job. Each job can take a status and some statuses means the jobs' deadlines must be deleted from the other table. I can easily SELECT the jobs/deadlines that meets my criteria with a LEFT JOIN: SELECT * FROM `deadline` LEFT JOIN `job` ON deadline.job_id = job.job_id W...

MySQL: SSH Connection through Terminal in MAC

Hi Thanks for reading my question. I currently use Mac Terminal to use MySQL. I connect to either localhost or a remote server. Should I be using SSH? ...

How to create Insert script using c#

From my c# code behind, i pass a query to mysql database and get the data in a DataTable. Now i want to use the data in data table to write the Insert query in a script file [.sql] The objective of doing so is, whatever records i select from mysql, i should write that to a script file as backup. Thais why i need the insert statements. ...

Stored Procedure to create Insert statements in MySql ??

I need a storedprocedure to get the records of a Table and return the value as Insert Statements for the selected records. For Instance, The stored procedure should have three Input parameters... 1- Table Name 2- Column Name 3- Column Value If 1- Table Name = "EMP" 2- Column Name = "EMPID" 3- Column Value = "15" Then the outp...

export and import utf8 data in mysql: best practices

We're often faced with the need to send a data file to one of our clients with data from the database he/she needs to translate. Most of the time this export is CSV or XLS. Most of the time we create a csv dump with phpmyadmin and get an xls file in return with the translated data. The problem is that most of the time the data is UTF8 an...

how to query with child relations to same table and order this correctly

Hi, Take this table: id name sub_id --------------------------- 1 A (null) 2 B (null) 3 A2 1 4 A3 1 The sub_id column is a relation to his own table, to column ID. subid --- 0:1 --- id Now I have the problem to make a correctly SELECT query to show that the child ro...

convert SQL Server StoredPorcedure to MySql

I need to covert the following SP of SQL Server To MySql. I am new to MySql.. Help needed. CREATE PROC InsertGenerator (@tableName varchar(100)) as --Declare a cursor to retrieve column specific information --for the specified table DECLARE cursCol CURSOR FAST_FORWARD FOR SELECT column_name,data_type FROM information_schema.co...

CakePHP: Create form (records) with db-driven fields (record-fields), save user-provided field values elsewhere (record-datas).

Already developed few websites on top of CakePHP but now ran into a brick wall. To make things simple, here's the scenario: Database Schema: USERS - id - name RECORDS - id - user_id - timestamp RECORD_FIELDS - id - name RECORD_DATA - id - record_id - record_field_id - value Basically it's an control panel for staff that...

Correct sequence of actions when using Markdown & MySQL?

I want my users to be able to write an article in Markdown, have it stored in the MySQL database (with the option to edit it in the future), and displayed for other users. In practice, this is my understanding of how it works: INPUT user input via HTML form using Markdown syntax $queryInput = mysql_real_escape_string($userInput); ins...

function and class to show image not working in php

i am trying to get get the following working nothing is happen when i use the function i am trying to get it to display images class ItemRes { //items DB var $img=""; } function ShowItemImage($index,$res_a){ if(sizeof($res_a) > $index){ if($res_a[$index] != NULL) { $cimg = $res_a[$index]->img; return "<img src='$cimg' w...

Mysql count columns

I have a table for image gallery with four columns like: foid | uid | pic1 | pic2 | pic3 | date | ----------------------------------------------- 104 | 5 | 1.jpg | 2.jpg | 3.jpg | 2010-01-01 105 | 14 | 8.jpg | | | 2009-04-08 106 | 48 | x.jpg | y.jpg | | 2010-08-09 Mysql query for the user's galleries lo...