Go Down

Topic: Arduino yun Joomla SQL communications. (Read 14263 times) previous topic - next topic

chetto983

Hi there,

Do you Know if is possible, and how,  Arduino Yun send  and write data on Joomla SQL?

I have no ideas right now.

Thanks in advance for any help....


Best  regards,


Davide Marchetto



testato

- [Guida] IDE - http://goo.gl/ln6glr
- [Lib] ST7032i LCD I2C - http://goo.gl/GNojT6
- [Lib] PCF8574+HD44780 LCD I2C - http://goo.gl/r7CstH

federicofissore

Sorry for the silly question: I know joomla by name but what is joomla sql?

chetto983

I want send  and write data to Sql installed on joomla.



OttoF

is your joomla installed by an provider or in your own network ?
if it is installed by an provider i think you can not access the joomla database from outside the providers sever.

otherwise if you can acces the database joomla stored his "artikles" in
the table jos_content
in this table each row is an artikel identified by artikel ID,( you will found them in joomla backend by the artikel)
the fields introtext and fulltext includes the content of the artikel.
if you update this fields the new content will shown on the artikels webside.

chetto983

Yes Sql are installed on the provider.

So I have some other options for send and write  dafa  from-to my website with arduino Yun without  any intermediate connections?

OttoF

you can made your webside on your yun available from the internet
and then include yuns side wia iframe or link on your webside

sonnyyu

Joomla  normally use mysql as db backend,  Arduino yun Joomla SQL communications means yun to mysql communications.

1. Create test db at mysql server for test purpose.

Code: [Select]
mysql> CREATE DATABASE books;
mysql> USE books;
mysql> CREATE TABLE authors (id INT, name VARCHAR(20), email VARCHAR(20));
mysql> SHOW TABLES;
mysql> INSERT INTO authors (id,name,email) VALUES(1,"Vivek","xuz@abc.com");


2. Grant access right for remote client. It might need modify my.cnf.
Code: [Select]
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';

3. Use Lua to insert data

Code: [Select]
opkg update
opkg install luasql-mysql


nano  mysql.lua

Code: [Select]
#!/usr/bin/lua
require "luasql.mysql"
env = assert (luasql.mysql())
con = assert (env:connect('books', 'root', 'password', '192.168.0.20'))
res = assert (con:execute("INSERT INTO authors (id,name,email) VALUES(2,'lua','lua@gmail.com')"))

sonnyyu

Use python script to communication mysql:

Install python-mysql
Code: [Select]
opkg update
opkg install python-mysql


nano mysql.py

Code: [Select]
#!/usr/bin/python
# -*- coding: utf-8 -*-

import _mysql
import sys

try:
    con = _mysql.connect('192.168.0.20', 'root', 'password', 'books')
    #con.query("SELECT VERSION()")
    #result = con.use_result()
    #print "MySQL version: %s" %  result.fetch_row()[0]
con.query("INSERT INTO authors (id,name,email) VALUES(3,'python','python@yahoo.com')")
   
except _mysql.Error, e:
 
    print "Error %d: %s" % (e.args[0], e.args[1])
    sys.exit(1)

finally:
   
    if con:
        con.close()



sonnyyu

Use ash script to SQL communication,

install mysql client

Code: [Select]
opkg update
opkg install mysql-server


nano mysql

Code: [Select]
#!/bin/ash
mysql --host=192.168.0.20 --user=root --password=password books<< EOF
INSERT INTO authors (id,name,email) VALUES(4,'ash','ash@yahoo.com');
EOF

sonnyyu

Use php for mysql communication,

There are three ways to do it:

1.  MySQL shared module

Code: [Select]
opkg update
opkg install php5-mod-mysql


2. MySQL Improved Extension

Code: [Select]
opkg update
opkg install php5-mod-mysqli


3. PHP Data Objects plus PDO driver for MySQL

Code: [Select]
opkg update
opkg install php5-mod-pdo
opkg install php5-mod-pdo-mysql



OttoF

hello  sonyyu

thanks for the great posts, i have learned a lot,
but i think chetto,want to write into a sql database by an external provider
not in a local database on yun.

do you think there is a possibility to do this ?

sonnyyu

#13
Dec 29, 2013, 08:33 pm Last Edit: Dec 29, 2013, 08:38 pm by sonnyyu Reason: 1

hello  sonyyu

thanks for the great posts, i have learned a lot,
but i think chetto,want to write into a sql database by an external provider
not in a local database on yun.

do you think there is a possibility to do this ?


192.168.0.20 set on an other linux box which setup mysql server for test.

modify my.cnf for communication from not only localhost but also internet, Grant access right for remote client.  install opkg install mysql-server really for mysql-client only. I did not start mysql-server at yun.  for internet access firewall need open 3306 port.



msssltd

It depends on what traffic the provider will allow through their firewall. 

Many of the very cheapest providers will not allow any access below the Web based Control panels they provide.  Some providers will only allow access to the MySQL port from a static IP address.  Some other providers don't allow access to the MySQL port but provide SSH access, in which case you can create a tunnel and run the client locally or remotely.  Some providers do not advertise SSH or MySQL port access but will provide it unsupported on request - Always worth asking.

 

Go Up