Search Results

Search found 36111 results on 1445 pages for 'mysql update'.

Page 127/1445 | < Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >

  • Convert MYSQL Timestamp to time_t

    - by Kewley
    I'm writing a multi-threaded program that needs to be able to check if a row requires updating and act accordingly. I had problems using the built in date/time functions of MySql and so decided to just store the "lastupdate" timestamp as an integer in the table. However, I'm having problems converting this timestamp to time_t so that I can use the time functions with it. Any help is greatly appreciated.

    Read the article

  • Mysql locale session variable ?

    - by Maxim Veksler
    Hunting internationalization bugs here. Does mysql has a variable which can be set per session, meaning the each connection will know the timezone of it's client and will act upon that. If such variable does exists I would expect sql statements such as the following will return diffect values, based on connection session locale. select date('2010-04-14') + 0; Thank you, Maxim.

    Read the article

  • Migrating .NET/MySQL app. to DB2

    - by RPK
    I want to migrate my existing desktop Windows .NET 3.5 app. that uses MySQL as backend to DB2 Express C. I downloaded IBM Migration Toolkit to migrate the database. I have further queries: How accurate is IBM Migration Toolkit? Are there any issues? For the application, just changing the connection string will do or something else?

    Read the article

  • MySQL Query Help, including a count?

    - by nobosh
    Any ideas why this isn't working in MySQL? SELECT blogentry.*, person.personName, (SELECT * FROM BlogEntryComment Where BlogEntryID = '8') as CommentCount FROM blogentry INNER JOIN person ON blogentry.personID = person.personID WHERE blogentry.deleted = 'N' ORDER BY blogentry.dateAdded DESC

    Read the article

  • Date problem in MYSQL Query

    - by davykiash
    Am looking for a query to sum values in a particular time duration say an year or a particular month in an year using MYSQL syntax.Note that my transaction_date column stores daily amount transacted. Am example of a query that returns total sales in an year query would look something like this SELECT SUM(transaction_amount) WHERE transaction_date = (YEAR) Am example of a query that returns total sales in an particular month and year would look something like this SELECT SUM(transaction_amount) WHERE transaction_date = (YEAR)(MONTH) How achievable is this?

    Read the article

  • error in mysql syntax

    - by fusion
    while executing the following query, i get an error that there's an error in the syntax near line 9. since i'm using mysql workbench, i can't really figure out what could be wrong: CREATE TABLE IF NOT EXISTS `proquotes`.`thquotes` ( `idQuotes` INT NOT NULL AUTO_INCREMENT , `vAuthorID` VARCHAR(8) CHARACTER SET 'utf8' NOT NULL , `vAuthor` VARCHAR(45) CHARACTER SET 'utf8' NOT NULL , `cQuotes` MEDIUMTEXT CHARACTER SET 'utf8' NOT NULL , `cArabic` MEDIUMTEXT CHARACTER SET 'utf8' NOT NULL , `vReference` VARCHAR(100) CHARACTER SET 'utf8' NOT NULL , PRIMARY KEY (`idQuotes`) , INDEX `vAuthorID` () , CONSTRAINT `vAuthorID` FOREIGN KEY () REFERENCES `proquotes`.`author_info` () ON DELETE NO ACTION ON UPDATE NO ACTION) DEFAULT CHARACTER SET = utf8;

    Read the article

  • Optimize mysql table ?

    - by fabien-barbier
    Here is my actual table schema (I'm using Mysql) : Table experiment : code(int) sample_1_id sample_2_id ... until ... sample_12_id rna_1_id rna_2_id ... until ... rna_12_id experiment_start How can I optimize both part : sample_n_id and rna_n_id (all are bigint(20) and allow null=true) ? About values : we can have : ex : sample_1_id = 2 , Sample_2_id = 5 , ... Note : values can be updated. Ideas ? Thanks.

    Read the article

  • Why MAMP sets to 600 MySQL file permission?

    - by SergioP
    I usually put MAMP MySQL /db/db-site-name folder under SVN. When MAMP starts, it gives the drw------- (600) permission to all the files and dir in that folder. I have a problem because one of these folder is .svn one, that have to be drwxr-xr-x (755), otherwise I can't access to SVN working copy with my client. Can anyone help me to set MAMP properly?

    Read the article

  • MySQL table partitioning qn:

    - by JVXR
    I have a table (innodb) that will have billions of records eventually. Every 2nd week I expect ~ 500K records to get dropped into the table. I would want to partition this table based on the date on which the data is imported - luckily this is a field in the table that is of the format yyyy-mm-dd - Is it possible to partition it based on this date column ? I tried looking at the 18th chapter of mysql docs but couldn't figure out if this is possible. -tia

    Read the article

  • what is the purpose of this mysql query ?

    - by Harbhag
    SELECT id, CONCAT(lastname,', ',firstname) AS fullname, lastname, firstname FROM " . TABLE_CONTACT . " WHERE CONCAT(firstname,' ', lastname) LIKE '%$goTo%' OR CONCAT(firstname,' ', middlename,' ', lastname) LIKE '%$goTo%' OR nickname LIKE '%$goTo%' ORDER BY fullname"; Can anyone please tell me what is purpose of above query ? I am new to mysql so unable to understand it. Thanks

    Read the article

  • Looking for MySQL IDE?

    - by David Negron
    I've recently been tasked with developing a web application that will use a MySQL database on the back end. I for most of my career I have worked with MS-SQL Manager. My greatest weakness is in defining foreign key constraints I usually use MS-SQL Manager's diagramming tool to draw my relationship lines between tables.

    Read the article

  • mysql utf encoding

    - by user121196
    java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'xxxx' the column is a longtext in MYSQL with utf8 charset and utf8_general_ci collation. what's wrong?

    Read the article

  • MySQL Collation or PHP side to display accented letters properly

    - by Wayne
    What is the best Collation for the column that can allow to store accented letters and parse them out perfectly without any encoding error, because whenever I add an accented letter such as é, å, it shows out with an encoding problem on the PHP side, but in the MySQL side it's fine... How do I get the accented letters display properly?

    Read the article

  • Disable MySQL general logging without restarting?

    - by shantanuo
    Can I disable general logging completely without restarting the server? Because, per the documentation: SET sql_log_bin = {0|1} Disables or enables binary logging for the current connection (sql_log_bin is a session variable) if the client has the SUPER privilege. The statement is refused with an error if the client does not have that privilege. Can I enable/disable general log without restarting MySQL?

    Read the article

  • Connection drop problem with Hibernate-mysql-c3p0

    - by user344788
    hi all, This is an issue which I have seen all across the web. I will bring it up again as till now I don't have a fix for the same. I am using hibernate 3. mysql 5 and latest c3p0 jar. I am getting a broken pipe exception. Following is my hibernate.cfg file. com.mysql.jdbc.Driver org.hibernate.dialect.MySQLDialect <property name="hibernate.show_sql">true</property> <property name="hibernate.use_sql_comments">true</property> <property name="hibernate.current_session_context_class">thread</property> <property name="connection.autoReconnect">true</property> <property name="connection.autoReconnectForPools">true</property> <property name="connection.is-connection-validation-required">true</property> <!--<property name="c3p0.min_size">5</property> <property name="c3p0.max_size">20</property> <property name="c3p0.timeout">1800</property> <property name="c3p0.max_statements">50</property> --><property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider </property> <property name="hibernate.c3p0.acquireRetryAttempts">30</property> <property name="hibernate.c3p0.acquireIncrement">5</property> <property name="hibernate.c3p0.automaticTestTable">C3P0TestTable</property> <property name="hibernate.c3p0.idleConnectionTestPeriod">36000</property> <property name="hibernate.c3p0.initialPoolSize">20</property> <property name="hibernate.c3p0.maxPoolSize">100</property> <property name="hibernate.c3p0.maxIdleTime">1200</property> <property name="hibernate.c3p0.maxStatements">50</property> <property name="hibernate.c3p0.minPoolSize">10</property>--> My connection pooling is occurring fine. During the day it is fine , but once i keep it idle over the night ,next day I find it giving me broken connection error. public class HibernateUtil { private static Logger log = Logger.getLogger(HibernateUtil.class); //private static Log log = LogFactory.getLog(HibernateUtil.class); private static Configuration configuration; private static SessionFactory sessionFactory; static { // Create the initial SessionFactory from the default configuration files try { log.debug("Initializing Hibernate"); // Read hibernate.properties, if present configuration = new Configuration(); // Use annotations: configuration = new AnnotationConfiguration(); // Read hibernate.cfg.xml (has to be present) configuration.configure(); // Build and store (either in JNDI or static variable) rebuildSessionFactory(configuration); log.debug("Hibernate initialized, call HibernateUtil.getSessionFactory()"); } catch (Throwable ex) { // We have to catch Throwable, otherwise we will miss // NoClassDefFoundError and other subclasses of Error log.error("Building SessionFactory failed.", ex); throw new ExceptionInInitializerError(ex); } } /** * Returns the Hibernate configuration that was used to build the SessionFactory. * * @return Configuration */ public static Configuration getConfiguration() { return configuration; } /** * Returns the global SessionFactory either from a static variable or a JNDI lookup. * * @return SessionFactory */ public static SessionFactory getSessionFactory() { String sfName = configuration.getProperty(Environment.SESSION_FACTORY_NAME); System.out.println("Current s name is "+sfName); if ( sfName != null) { System.out.println("Looking up SessionFactory in JNDI"); log.debug("Looking up SessionFactory in JNDI"); try { System.out.println("Returning new sssion factory"); return (SessionFactory) new InitialContext().lookup(sfName); } catch (NamingException ex) { throw new RuntimeException(ex); } } else if (sessionFactory == null) { System.out.println("calling rebuild session factory now"); rebuildSessionFactory(); } return sessionFactory; } /** * Closes the current SessionFactory and releases all resources. * <p> * The only other method that can be called on HibernateUtil * after this one is rebuildSessionFactory(Configuration). */ public static void shutdown() { log.debug("Shutting down Hibernate"); // Close caches and connection pools getSessionFactory().close(); // Clear static variables sessionFactory = null; } /** * Rebuild the SessionFactory with the static Configuration. * <p> * Note that this method should only be used with static SessionFactory * management, not with JNDI or any other external registry. This method also closes * the old static variable SessionFactory before, if it is still open. */ public static void rebuildSessionFactory() { log.debug("Using current Configuration to rebuild SessionFactory"); rebuildSessionFactory(configuration); } /** * Rebuild the SessionFactory with the given Hibernate Configuration. * <p> * HibernateUtil does not configure() the given Configuration object, * it directly calls buildSessionFactory(). This method also closes * the old static variable SessionFactory before, if it is still open. * * @param cfg */ public static void rebuildSessionFactory(Configuration cfg) { log.debug("Rebuilding the SessionFactory from given Configuration"); if (sessionFactory != null && !sessionFactory.isClosed()) sessionFactory.close(); if (cfg.getProperty(Environment.SESSION_FACTORY_NAME) != null) { log.debug("Managing SessionFactory in JNDI"); cfg.buildSessionFactory(); } else { log.debug("Holding SessionFactory in static variable"); sessionFactory = cfg.buildSessionFactory(); } configuration = cfg; } } Above is my code for the session factory. And I have only select operations . And below is the method which is used most often to execute my select queries. One tricky thing which I am not understanding is in my findById method i am using this line of code getSession().beginTransaction(); without which it gives me an error saying that this cannot happpen without a transaction. But nowhere I am closing this transaction. And thers no method to close a transaction apart from commit or rollback (as far as i know) which are not applicable for select statements. public T findById(ID id, boolean lock) throws HibernateException, DAOException { log.debug("findNyId invoked with ID ="+id+"and lock ="+lock); T entity; getSession().beginTransaction(); if (lock) entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE); else entity = (T) getSession().load(getPersistentClass(), id); return entity; } Can anyone please suggest what can I do ? I have tried out almost every solution available via googling, on stackoverlow or on hibernate forums with no avail. (And increasing wait_timeout on mysql is not a valid option in my case).

    Read the article

  • Connect MySQL database from Android

    - by Mistry Hardik
    hello people! well this is the code snippet i use to access the getUser.php to retrive user details from a MySQL database in my application: String result = ""; //the year data to send ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("uid","demo")); //http post try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://192.xxx.xx.xxx/getUser.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); }catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); } //convert response to string try{ InputStream is = null; BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //parse json data try{ JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); Log.i("log_tag","id: "+json_data.getInt("id")+ ", name: "+json_data.getString("fname")+ ", sex: "+json_data.getInt("sex")+ ", birthyear: "+json_data.getInt("dob") ); } } catch(JSONException e){ Log.e("log_tag", "Error parsing data "+e.toString()); } } This snippet is taken from http://helloandroid.com Everything is configured fine: the MySQL Db, IIS with FASTCGi, PHP tools and drivers. even the script below when called from browser with url: http://192.xxx.xx.x.xxx/getUser.php?uid=demo works fine, But returns error in android with java.lang.NullPointerException and org.json.JSONEXCEPTION: End of input at character 0 <?php mysql_connect("myhost","username","pwd"); mysql_select_db("mydb"); $q=mysql_query("SELECT * FROM userinfo WHERE uid ='".$_REQUEST['uid']."'"); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); mysql_close(); ?> Can anybody help in this section? Regards, Mistry Hardik

    Read the article

  • Mysql::Error: Duplicate entry

    - by Shaliko
    Hi I have a model class Gift < ActiveRecord::Base validates_uniqueness_of :giver_id, :scope => :account_id end add_index(:gifts, [:account_id, :giver_id], :uniq => true) Action def create @gift= Gift.new(params[:gift]) if @gift.save ... else ... end end In the "production" mode, I sometimes get an error ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry '122394471958-50301499' for key 'index_gifts_on_account_id_and_user_id' What the problem?

    Read the article

  • Database INSERT does not take place

    - by reggie
    My code is as follows: <?php include("config.php"); $ip=$_SERVER['REMOTE_ADDR']; if($_POST['id']) { $id=$_POST['id']; $id = mysql_escape_String($id); $ip_sql=mysql_query("select ip_add from Voting_IP where mes_id_fk='$id' and ip_add='$ip'"); $count=mysql_num_rows($ip_sql); if($count==0) { $sql = "update Messages set up=up+1 where mes_id='$id'"; mysql_query($sql); $sql_in = "insert into Voting_IP (mes_id_fk,ip_add) values ('$id','$ip')"; mysql_query($sql_in) or die(mysql_error()); echo "<script>alert('Thanks for the vote');</script>"; } else { echo "<script>alert('You have already voted');</script>"; } $result=mysql_query("select up from Messages where mes_id='$id'"); $row=mysql_fetch_array($result); $up_value=$row['up']; echo "<img src='button.png' width='110' height='90'>"; echo $up_value; } ?> My problem is that the insert process does not take place at all. The script tags echos an alert box. Even the img tag is echoed to the web page. But the insert process does not take place. The config file is fine. Note: This code works on my local machine which has PHP 5.3 but it does not work on the server which has PHP 5.2. Any advice?

    Read the article

< Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >