Search Results

Search found 18661 results on 747 pages for 'linq to mysql'.

Page 202/747 | < Previous Page | 198 199 200 201 202 203 204 205 206 207 208 209  | Next Page >

  • Mysql Master Slave Replication on Large Database table (how to sync initial data)

    - by Brian Lovett
    We have a production server and a dev server. We have found that backups are nearly impossible on the production server because of the query volume we experience. So, we're looking at setting up replication with our dev server being the slave. This is ideal because we can afford to lock the tables on that server and additionally it will be nice to have up to date data for the developers. Now, the issues. The production server can't really be taken down or locked at this point, at least not easily. We have a high query volume and fairly large 30+ GB innodb tables. Both servers are running all innodb and are also both on mysql 5.1. What can we do to sync the data initially to get replication started? I've tried a few options, but so far, none have worked.

    Read the article

  • mysql reference result from subquery

    - by iamrohitbanga
    this is what i am doing update t1 set x=a,y=b where a and b are obtained from (select query here) i know the select query the select query returns multiple results which are the same when i use group by or distinct query execution slows down considerably a and b are forward references so mysql reports an error i want to set a equal to the value obtained in the first row and b equal to the value obtained in the first row for the respective columns, to avoid group by. i don't know how to refer to the first result from the select query. how can i achieve all this?

    Read the article

  • MySQL Locking table from Stored FUNCTION

    - by Brandon
    I have a function in a MySQL Database that determines some sync parameters for a mobile device. The function determines the last date/time the user synchronized with the database. During my sync operation I call this server side function twice. As soon as I call it the second time - the entire Sync_Records table is locked. I cannot write to it from any other connection anywhere (note, after first call, the table is not locked). I changed the function to a Procedure - and all is fine - no locking after the second call. The entire sync operation (including both calls to the function/procedure) is within a transaction. This is an InnoDb table. The function/procedure simply does two select statements. They are storing results in local variables and then returning the date time variable. I don't understand why the tables are locked. Does anyone have any ideas?

    Read the article

  • create and insert values using mysql JDBC

    - by S.PRATHIBA
    Hi all, I have the sample code. public void UpdateTable1() { for(int t=0;t<20;t++) { if(consumer==1 && number==1 && provider1==31 && feedback==1) { try{ Class.forName(driverName); con = DriverManager.getConnection(url+dbName,"root","mysql"); try { Statement st = con.createStatement(); int val = st.executeUpdate("INSERT Consumer1 VALUES ("+31+","+"'Printer'"+", "+1+" "+")"); System.out.println("1 row affected"); } catch (SQLException s) { System.out.println("SQL statement is not executed!"); } con.close(); } I want to insert the same set of values(31,printer,1) into the table consumer2,consumer3.Is it possible without using another try catch statements...Please help me.

    Read the article

  • MySQL - Where - search string - MATCH.

    - by Jamie
    Hi guys, Quick question. I'm in a bit of a rush but if someone could quickly point me in the right direction I would be very very happy. I have a field in the db, let's call it field_a which returns a string in the format "20,50,60,80" etc. I wish to do a query which will search in this field to see if 20 exists. Could I use MySQL MATCH or is there a better way? Thank you!

    Read the article

  • Two drop down lists in Ajax and MySQL

    - by Milla
    I'm trying to learn some Ajax and MySQL... Basically, the code that I have right now is similar to: http://www.w3schools.com/PHP/php_ajax_database.asp I was wondering how should I modify those codes (both html, javascript and php) to create two drop down lists. The first drop list would be used for choosing the Lastname (eg. Swanson) and the second drop list would be used for choosing the Hometown (eg. Quahog). Then the user would click "Submit" button and the query would return the matching results (eg. all the Swansons living in Quahog). I'd be very thankful for all the ideas!

    Read the article

  • dymanic columns in mysql tables?

    - by fayer
    i want to add dynamic columns in a mysql table. but i dont know exactly how. i want to let the user add some columns (fields) in a thread. eg. let him add a integer field and a value (eg. price: 199) or a string field and a value (eg. name: teddybear). the user can add as many field/value-pairs as he wants. i thought i could create a many-to-many table: thread <- thread_field <- field thread: id, title thread_field: field_id, thread_id, value field: id, name is this a good structure? but in this way i have to set a specific column type of thread_field.value. either its an integer or a string. i want to have the possibility to have it dymanic, let the user choose. how can i do this? thanks!

    Read the article

  • Problem executing with Python+MySQL

    - by Satya
    Hi, I am not getting the reason why my python script is not working though I hv put all the things correctly as my knowledge.The below test I did and it worked fine.But when I import the MySQLdb in my script it gives error as no module name MySQLdb. **C:\Python26python Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import MySQLdb ** Kindly let me know the reason for this error. And all the development is going on in windows XP, python 2.6, mysql 4.0.3 Earlier 1 hour back I have posted the question but some mistake was there in the question itself..

    Read the article

  • Zend Database Adapter - Complex MySQL Query

    - by Sonny
    I have defined a function in my Navigation model that executes a query, and I was wondering if there's a more "Zendy" way of generating/executing the query. The query I'm using was proposed by Bill Karwin on another thread here for setting arbitrary record order. I tried using a prepared statement, but the values in the SIGN() function got quoted. I'm using the PDO adapter for MySQL. /** * */ public function setPosition($parentId, $oldPosition, $newPosition) { $parentId = intval($parentId); $oldPosition = intval($oldPosition); $newPosition = intval($newPosition); $this->getAdapter()->query(" UPDATE `navigation` SET `position` = CASE `position` WHEN $oldPosition THEN $newPosition ELSE `position` + SIGN($oldPosition - $newPosition) END WHERE `parent_id` = $parentId AND `position` BETWEEN LEAST($oldPosition, $newPosition) AND GREATEST($oldPosition, $newPosition) "); return $this; }

    Read the article

  • MySQL update error when special characters are used

    - by Katy
    Hi All, I was wondering if anyone had come across this one before. I have a customer who uses special characters in their product description field. Updating to a MySQL database works fine if we use their HTML equivalents but it fails if the character itself is used (copied from either character map or Word I would assume). Has anyone seen this behaviour before? The character in question in this case is ø - and we can't seem to do a replace on it (in ASP at least) as the character comes though to the SQL string as a "?". Any suggestions much appreciated - thanks!

    Read the article

  • mysql stored procedures using php

    - by neo skosana
    I have a stored procedure: delimiter // create procedure userlogin(in eml varchar(50)) begin select * from users where email = eml; end// delimiter ; And the php: $db = new mysqli("localhost","root","","houseDB"); $eml = "[email protected]"; $sql = $db-query("CALL userlogin('$eml')"); $result = $sql-fetch_array(); The error that I get from the browser when I run the php script: Fatal error: Call to a member function fetch_array() on a non-object... I am using phpmyadmin version 3.2.4 and mysql client version 5.1.41. Please help. Thank you.

    Read the article

  • wrong data type in mysql for grails byte[] property

    - by srkiNZ84
    Hi, I have an application which is trying to save a photo to the database. I've created a grails domain class with a byte[] property and this was working well when using HSQLDB (the default in grails). However, when I changed the database to MySQL I ended up getting the following error: Data truncation: Data too long for column 'photo' at row 1 I then had a look at the schema and found that the byte[] was being created as a TINYBLOB field, which was causing the error. How can I specify that this property should correspond to a BLOB/LONGBLOB type in the database?

    Read the article

  • trying to put an mysql result into a string

    - by user1583432
    I'm trying to put an mysql query result into an string I tried to find an answer but all the similar posts were getting subquery answers which is not what I'm trying to do. for example Fruits_tbl ID Fruit Color Number __________________________________ 2 Apple Red 5 $sql = "select Fruits,Color,Number from Fruits_tbl where ID = 2"; $result = $pdo->query($sql); $row = $result->fetch(); print_r($row); This will give me something like Array([0]="Apple", [1]="Red", [2]="5", [Fruit]="Apple", [Color]="Red", [Number]="5") implode will give me 2 of each I want just need a string = "Apple, Red, 5" what I currently have is $string = $row[Fruit].", ".$row[Color].", ".$row['Number'] As you can see that's rather tedious. Is there something like implode but only return the index array or something?

    Read the article

  • viewing data using php and mysql

    - by circle
    hello, i'm circle.very new in php and mysql.i need to develop a website include with database.but i have a problem with this. i'm using php and sql to develop it.my task is: i have two table, investor and commission. investor have three level which is coordinator, consultant and participant.what should i do is, only coordinator can add consultant and participant in their profile.and only coordinator can add participant in their profile. so here, when investor was login, and they go to view commission, they only can see their owned coordinator and participant. but i'm stuck when they want to view the commission.maybe it only a simple thing, but i cannot solved it. help me..:(

    Read the article

  • How to find root cause for "too many connections" error in MySQL/PHP

    - by Nir
    I'm running a web service which runs algorithms that serve millions of calls daily and run some background processing as well. Every now and than I see "Too many connections" error in attempts to connect to the MySQL box" for a few seconds. However this is not necessarily attributed to high traffic times or anything I can put my finger on. I want to find the bottleneck causing it. Other than in the specific times this happens the server isn't too loaded in terms of CPU and Memory, and has 2-3 connections (threads) open and everything works smoothly. (I use Zabbix for monitoring) Any creative ideas on how to trace it?

    Read the article

  • Mysql maven jpa skeleton

    - by coubeatczech
    Hi, is there a skeleton for a project using mysql, some eclipse/top link with RESOURCE_LOCAL as connection type? Preferably using maven. I'm searching for it for hours and can't get running even the sipmlest exaple. So if you had it ready and running, please, post :-). Even something as simple as these two classes only. @Entity public class Message implements Serializable{ public Message() {} public Message(String s){ this.s = s; } @Id String s; public String getS(){ return s; } } public class App { static private EntityManagerFactory emf; static private EntityManager em; public static void main( String[] args ) { emf = Persistence.createEntityManagerFactory("persistence"); em = emf.createEntityManager(); Message m = new Message("abc"); em.persist(m); } }

    Read the article

  • MySQL ON DUPLICATE KEY UPDATE issue

    - by user644347
    Hi could some one look at this and tell me where I am going wrong. I have an SQL statement that when I echo using php I get this to screen INSERT INTO 'moviedb'.'genre' SET 'GenreID' = '18' , 'GenreName' = 'Drama' ON DUPLICATE KEY UPDATE 'GenreName' = 'Drama' WHERE 'GenreID' = '18' INSERT INTO 'moviedb'.'genre' SET 'GenreID' = '16' , 'GenreName' = 'Animation' ON DUPLICATE KEY UPDATE 'GenreName' = 'Animation' WHERE 'GenreID' = '16' And here is the statement $sql="INSERT INTO 'moviedb'.'genre' SET 'GenreID' = '{$genresID[$i]}' , 'GenreName' = '{$genreName[$i]}' ON DUPLICATE KEY UPDATE 'GenreName' = '{$genreName[$i]}' WHERE 'GenreID' = '{$genresID[$i]}'"; This is the error I recieve: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''moviedb'.'genre' SET 'GenreID' = '18' , 'GenreName' = 'Drama' ON DUPLICATE KEY ' at line 1 Any help would be greatly appreciated, thanks in advance.

    Read the article

  • Regular Expression for exclude something that has specific word inside bracked (MySQL)

    - by bn
    This Regular expression if for MySQL query: I want to exclude this row because it has 'something' in side the bracket "bla bla bla bla bla bla (bla bla bla something)" However I want to include this row, because it does not have 'something' inside the bracket "bla bla bla (bla bla bla)" I tried this query but it didnt work. SELECT * FROM table WHERE field NOT REGEXP '((%something%))'; I think this is wrong, I just did trial and error, I like to use regular expression, but never understand it completely. is there any good tutorial/books/links for learning the detail of regular expression? Thank You

    Read the article

  • Converting delimited string to multiple values in mysql

    - by epo
    I have a mysql legacy table which contains an client identifier and a list of items, the latter as a comma-delimited string. E.g. "xyz001", "foo,bar,baz". This is legacy stuff and the user insists on being able to edit a comma delimited string. They now have a requirement for a report table with the above broken into separate rows, e.g. "xyz001", "foo" "xyz001", "bar" "xyz001", "baz" Breaking the string into substrings is easily doable and I have written a procedure to do this by creating a separate table, but that requires triggers to deal with deletes, updates and inserts. This query is required rarely (say once a month) but has to be absolutely up to date when it is run, so e.g. the overhead of triggers is not warranted and scheduled tasks to create the table might not be timely enough. Is there any way to write a function to return a table or a set so that I can join the identifier with the individual items on demand?

    Read the article

  • advanced search with mysql

    - by Arsenal
    I'm creating a search function for my website where the user can put in anything he likes in a textfield. It get's matched against anything (name, title, job, car brand, ... you name it) I initially wrote the query with an INNER JOIN on every table that needed to be searched. SELECT column1, column2, ... FROM person INNER JOIN person_car ON ... INNER JOIN car ... This ended up in a query with 6 or 8 INNER JOINs, and a whole lot WHERE ... LIKE '%searchvalue%' Now this query seems to cause a time'out in MySql, and I even got a warning from my hosting provider that the queries just taking up too many resources. Now obviously I'm doing this very wrong, but I was wondering how the correct approach to these kind of search functions is. Thanks!

    Read the article

  • mysql select where count = 0

    - by david parloir
    Hi, In my db, I have a "sales" table and a "sales_item". Sometimes, something goes wrong and the sale is recorded but not the sales item's. So I'm trying to get the salesID from my table "sales" that haven't got any rows in the sales_item table. Here's the mysql query I thought would work, but it doesn't: SELECT s.* FROM sales s NATURAL JOIN sales_item si WHERE s.date like '" . ((isset($_GET['date'])) ? $_GET['date'] : date("Y-m-d")) . "%' AND v.sales_id like '" . ((isset($_GET['shop'])) ? $_GET['shop'] : substr($_COOKIE['shop'], 0, 3)) ."%' HAVING count(si.sales_item_id) = 0; Any thoughts?

    Read the article

  • Streaming large result sets with MySQL

    - by configurator
    I'm developing a spring application that uses large MySQL tables. When loading large tables, I get an OutOfMemoryException, since the driver tries to load the entire table into application memory. I tried using statement.setFetchSize(Integer.MIN_VALUE); but then every ResultSet I open hangs on close(); looking online I found that that happens because it tries loading any unread rows before closing the ResultSet, but that is not the case since I do this: ResultSet existingRecords = getTableData(tablename); try { while (existingRecords.next()) { // ... } } finally { existingRecords.close(); // this line is hanging, and there was no exception in the try clause } The hangs happen for small tables (3 rows) as well, and if I don't close the RecordSet (which happened in one method) then connection.close() hangs.

    Read the article

  • MySQL UpdateXML with automatic node inserting?

    - by JimPsr
    I am writing an application that supports custom fields. Currently I store all custom fields in a XML formated text field ( e.g. '<root><field1>val1</field1><field2>val2</field2></root>' in cust_field) I am able to to use updateXML(cust_field, '/root/field1', '<field1>new value</field1') to update those values, however if I use updateXML(cust_field, '/root/field3', '<field3>new value</field3>') then it does not work since field3 is not in the old value. Is there a way to let MySQL automatically insert the new field3 node and its value into cust_field? I am thinking about stored procedure or even stored function but not familiar with both, can anyone point me to the right direction?

    Read the article

  • Using MySQL as a job queue

    - by user237815
    I'd like to use MySQL as a job queue. Multiple machines will be producing and consuming jobs. Jobs need to be scheduled; some may run every hour, some every day, etc. It seems fairly straightforward: for each job, have a "nextFireTime" column, and have worker machines search for the job with the nextFireTime, change the status of the record to "inProcess", and then update the nextFireTime when the job ends. The problem comes in when a worker dies silently. It won't be able to update the nextFireTime or set the status back to "idle". Unfortunately, jobs can be long-running, so a reaper thread that looks for jobs that have been inProcess too long isn't an option. There's no timeout value that would work. Can anyone suggest a design pattern that would properly handle unreliable worker machines?

    Read the article

  • [php + mysql] Save IP in database

    - by Knarf
    When a user logs inn I want to save their IP in the database. How would I do that? What type is best to use for the MySQL field? How would the PHP code to get IP look like? I'm thinking of using it as an extra security feature for the login/session stuff. I'm thinking of checking the IP the user logged in with from the DB with the IP the user have now as addition to checking the session. So that it first check the session, and then check if you have a valid IP. Is that an allright extra feature? And what other things can I do to make it more secure?

    Read the article

< Previous Page | 198 199 200 201 202 203 204 205 206 207 208 209  | Next Page >