MySql

Hello All,
I have created a database in Mysql now i need to link that database with my xojo project
so please anyone can help me how to interface that one & also please tell how to interface particular database to a label or text field

Please ask more concrete questions.

There a dozens of methods to show data from a database. One is here: http://www.bkeeney.com/rbinto/activerecord/ .

ok sir I will try this
Thanks

If you look in C:\Program Files (x86)\Xojo\Xojo 2016r1\Example Projects\Database\MySQL there should be an example. (folder might be different on your system)

BTW: is MySQL free with Xojo now ?

MySQL is GPL, but yes Xojo supports it for MySQL Community Edition databases.

I was thinking at your Xojo licence: does it include all Data Base support (only SQLite is free) ?

You also may want to read:
https://forum.xojo.com/20090-mysql-community-server-license

At last, I found it:

https://www.xojo.com/download/eula.php?lang=en

and search for Database; you will found:

If your application uses the Xojo Database API to access a database server, a Database Servers License Key will also be required.

Of course, I may be wrong.

Ahha I see what you mean :wink: No MySQL wont work on the free edition, I didn’t even think of checking, doh!

and the mysql licence on the server side is all but clear. it is not completely free as we understand it
if you begin with multiuser databases, better look at the postgres plugin
you need a database licence on the xojo side, but the server side is completely free for your deploiments.

Or, if it feet your needs, you can use the free SQLite database.

Mother web site is at http://sqlite.com/

More details (from Xojo web site) at: http://developer.xojo.com/kb/databases

HTH !

Sorry my bad english, :frowning:

  1. create a Property
    db as MySQLCommunityServer

  2. Open your Mysql, create a method

’ How to use


if DbOpenOk() = false then
  ' acces dont word
   return
end if
// create String to access any Recod

its very importar check if INTERNET ON
this is one of my method, create a Method named: TestInternetON as boolean

  Dim GoogleSocket As New HTTPSocket
  If GoogleSocket.Get("http://www.google.com", 2) <> "" Then
     ' Internet ok        
      return true
  Else
       ' Internet OFF
        return false
  End If

this is one method to open Database on Internet with Mysql ( you need License key to use Mysql, not free in xojo desktop)

create method Named: DbOpenOk as Boolean

' Check if Internet ON
  
  if TestInternetOn() = false then
    MsgBox("Sorry, internet OFF.  Try in any moment")
    ExitSoftware = true
    Quit
  end

   dim messprog as string

    ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
    ' Open Mysql Database
    ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
    dbSistema=New MySQLCommunityServer
    dbSistema.host="programafacil.cxx.xx" // if you no have Domain use: dbSistema.host="199.115.114.xxx"
    dbSistema.port= 3306
    dbSistema.databaseName="program6xx"
    dbSistema.userName="programxxxx"
    dbSistema.Password="sistema.xxxxxxxxxxxx"
    
    '  Conected ?
    
    If dbSistema.Connect = false  then
      ' No, check ErrorNumber
      if dbSistema.ErrorCode = 1045 then
        
        messprog= " Server pasword are changed, download a New Version"
        MsgBox(messprog)
        
        ExitSoftware = true
        Quit
        
      end

   ' its other error, show      
      messprog=  "   Error Nro: " + str(App.dbSistema.ErrorCode)+ EndOfLine
      messprog= messprog+ "   Messe: " + App.dbSistema.ErrorMessage+ EndOfLine  + EndOfLine
      MsgBox(messprog)
      
      ExitSoftware = true
      Quit
      
    End
    
    InfoResultado = true
  End

return    InfoResultado