martes, 4 de julio de 2017

MySql tinyInt1isBit = false

Hoy una entrada rápida que puede salvar más de un problema una vez que tenemos nuestra base de datos ya definida o simplemente la hemos heredado de otra persona o proveedor.

Que ocurre si tenemos definido un campo en una tabla MySQL como tinyint, este es un campo que se usa para almacenar datos de 8bits es decir valores de 0 a 255.

Pero normalmente se utiliza para valor es boolean tipo true false. En mi caso hoy hemos tenido un problema porque tenemos una columna definida con este tipo de datos y en la tabla tenemos valores 0, 1, 2, etc.... El problema ha surgido porque el driver de mysql php ha traducido el valor correctamente pero el de java no lo ha hecho.

El driver de php traduce correctamente el valor 2, pero en Java nos devuelve el valor true. 

Curioseando por la web hemos visto que si en los parámetros de conexión de MySQL añadimos la siguiente cadena de conexión en la conexión java tinyInt1isBit=false el valor será interpretado correctamente como un 2.

Esto a más de uno le puede salvar de más de un problema.

8 comentarios:

  1. you are posting a good information for people and keep maintain and give more update too.
    seo company in india


  2. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Title Car loan
    Cash Advance Loan

  3. I totally loved the way you presented the topic. Your way of presenting is good.

    Python Training in Chennai

  4. This blog is having the general information.Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog.This is very interesting and useful.

    Selenium Training in Chennai

  5. ts an awesome article. written in very creative way and it also conveys useful information.

    PYTHON Training in Chennai

  6. is an online platform that allows people to find offers and the greatest deals in and around OMR. It is the directory of the business in and around omr. It helps internet users to surf the required deals and offers.

    Offers in Chennai

  7. I must thank you for the efforts you have put in penning this site. I am hoping to check out the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own, personal blog now..
    Fleet Management Software
    ERP Software Companies

  8. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....

    Restaurant in OMR
    Apartments in OMR
    Villas in OMR
    Resorts in OMR