How to create a MySQL database connection with the iMX53?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a MySQL database connection with the iMX53?

1,546 Views
leonardfairclot
Contributor II

Has anyone successfully connected the iMX53 to a MySQL database and able to execute a stored procedure?

Labels (1)
Tags (4)
0 Kudos
4 Replies

1,045 Views
richard1094
Contributor III
0 Kudos

1,045 Views
leonardfairclot
Contributor II

Richard

I downloaded the C connection. I unzipped it and I now have a directory

called "/usr/local/mysql" under that there are three directories "bin".

"include", and "lib". under bin there is a mysql_config which looks

like an executable. I tried to run it and it told me to "sudo get-apt

install libmysqlclient-dev". I did this, now what?

Thanks

Leonard

0 Kudos

1,045 Views
richard1094
Contributor III

file : toolchain.cmake

//===============================

# this one is important

SET(CMAKE_SYSTEM_NAME Linux)

#this one not so much

SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler

SET(CMAKE_C_COMPILER   /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc)

SET(CMAKE_CXX_COMPILER /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-g++)

SET(CMAKE_STRIP           /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-strip)

# where is the target environment

SET(CMAKE_FIND_ROOT_PATH  /tftpboot/ltib)

#SET(CMAKE_FIND_ROOT_PATH  /opt/arm-2008q1/arm-none-linux-gnueabi/libc)

# search for programs in the build host directories

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories

SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)

SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

//===============================

file :  mysql_cmake.cmd

//===============================

cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake -DMYSQL_DATADIR=/var/lib/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_USER=mysql -DCMAKE_INSTALL_PREFIX=/tftpboot/ltib/usr/local/mysql -DWITH_EMBEDDED_SERVER=1 -DCMAKE_C_COMPILER=arm-none-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-none-linux-gnueabi-g++ -DSTACK_DIRECTION=1

//===============================

copy the two file to your Mysql Connector directory

chmod +x mysql_cmake.cmd

./mysql_cmake.cmd

make

// wait a minute for compile

file libmysql/libmysql.so.16.0.0

// you can see the key word : ARM

libmysql/libmysql.so.16.0.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

// if you want it to be install to some where (ex:/tftpboot/ltib/root/usr/local/mysql)


gedit cmake_install.cmake

    SET(CMAKE_INSTALL_PREFIX "/tftpboot/ltib/usr/local/mysql")


// change /tftpboot/ltib to your ltib/rootfs

make install

PS: use the Vmware image download from freescale , and use the default gcc toolchain in Vmware image

// http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX53QSB&fpsp=1&tab=Design_Tools_Tab

// IMX53_QSB_UBUNTU_VM

that all, good luck

0 Kudos

1,045 Views
leonardfairclot
Contributor II

Richard

Can you tell me how to install the connector on a linux machine?  I'm using the C connector.

0 Kudos