FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour connect to mysql server
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
connect to mysql server
Posted: Thu Jan 04, 2007 04:21 AM

Hil All !

how to connect this php on FWH

<?php

FileName="Connection_php_mysql.htm"

Type="MYSQL"

HTTP="true"

$hostname_cn = "localhost";
$database_cn = "mydata";
$username_cn = "myuser";
$password_cn = "mypassword";
$cn = mysql_pconnect($hostname_cn, $username_cn, $password_cn) or trigger_error(mysql_error(),E_USER_ERROR);
?>

notes :
hostname "localhost" OK when apache server running on my computer
the problem is when server running on (e.g) www.mysite.com

Regards
Areang

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: connect to mysql server
Posted: Thu Jan 04, 2007 10:42 AM
areang wrote:how to connect this php on FWH


Try using ADO. You can find the connection string on:

http://www.connectionstrings.com

EMG
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
connect to mysql server
Posted: Thu Jan 04, 2007 04:14 PM

Thank's Enrico

Could you mind to give me example ?

So many connection string on that site, which one for me ?

Best Regard
Areang

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
connect to mysql server
Posted: Thu Jan 04, 2007 04:58 PM
areang wrote:Thank's Enrico

Could you mind to give me example ?


No, sorry, as I haven't MySql to test.

areang wrote:So many connection string on that site, which one for me ?


OLE DB one:

Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;


EMG
Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
connect to mysql server
Posted: Thu Jan 04, 2007 11:45 PM
Hi all

The OleDB feature don't work with MySQL and Fivewin, OleDB is directed to .NET languages.

You can work with MySQL using MyODBC and this example string:

   StrDatabase := [mysql] // YouDatabaseName
   StrServer     := [127.0.0.1] // or remote IP ex: 202.204.69.101
   StrPort         := 3306
   StrUserID     := [root] 
   StrUserPWD  := [] // User ROOT don't use password
   StrDriver      := "MySQL ODBC 3.51 Driver"

   StrConnection := "driver={" + StrDriver +"}" + ;
                    ";database=" + StrDatabase + ;
                    ";server=" + StrServer + ;
                    ";uid=" + StrUserID + ;
                    ";pwd=" + StrUserPWD + ;
                    ";option=3;"


You need install in your machine MySQL 4(5 is not recomended to beginning) and MyODBC 3.51(best version).

You need a easy Front-End and you can download MySQL-Front, easy install and easy to use.

A have developed one Library to use all features of ADO, working with MySQL, SQL-Server, Firebird, Access, XLS, XML, SQLite e much more. You can download-it in http://www.shoppmarketing.com/blogADO e see the examples of use.

The new version accept SQL command directly in Fivewin code e have work to open various diferent connection at same time.
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
connect to mysql server
Posted: Fri Jan 05, 2007 12:14 AM
Rochinha wrote:The OleDB feature don't work with MySQL and Fivewin, OleDB is directed to .NET languages.


This is not true. OleDbConnection is for .NET but OLE DB is for Win32.

EMG
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
connect to mysql server
Posted: Fri Jan 05, 2007 07:56 AM

Mr. Enrico

Thank's for help

Regards
Areang

Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM
connect to mysql server
Posted: Sat Jan 06, 2007 01:17 PM
All right Mr. Enrico

it forgives my deceit

The OleDB Driver is not disponible in MySQL Site. I found it forgotten in http://download.softagency.net/MySQL/Downloads/Win32/.

AreaNG

You can a test with a server side of my Captor application. Download in http://www.shoppmarketing.com/forum/eserver.exe

The test consist in click on elements of tree to filter registers in the browse.

Part of program:
    ADORDDDefault( "MySQL" )

    StrConnection := "driver={" + StrDriver +"}" + ";database=" + StrDatabase + ;
                     ";server=" + StrServer + ;
                     ";uid=" + StrUserID + ;
                     ";pwd=" + StrUserPWD + ;
                     ";option=3;"

    ADO CONNECT StrConnection
    if .not. ADOConnected()
       ? "Conexao nao foi estabilizada. Aplicativo sera fechando."
       return .f.
    endif
    ADO USE clientes
    ADO USE proposta

    MainBrowse()

    ADO CLOSE



This is part of MainBrowse():
   @ 0,205 LISTBOX oLbx2 FIELDS SIZE 300,200 PIXEL OF oWnd
           oLbx2:bLine         := {|| { str(ADOField( "idfilial" ),5), ;
                                        str(ADOField( "idproposta" ),6), ;
                                        LoadResources(MostraStatus(ADOField("status"))), ;
                                        ADOField( "nome" ), ;
                                        alltrim(ADOField( "marca" ))+"-"+ADOField( "modelo" ), ;
                                        ADOField( "cic" ), ;
                                        transf( ADOField( "financiado" ), "@e 999,999.99" ), ;
                                        transf( ADOField( "entrada" ), "@e 999,999.99" ), ;
                                        transf( ADOField( "prazo" ), "@e 999,999.99" ), ;
                                        transf( ADOField( "parcela" ), "@e 999,999.99" ) } }


You can use test José Luis Capel class too. Found it in www.capelblog.com.
Posts: 128
Joined: Mon Jul 31, 2006 03:23 PM
connect to mysql server
Posted: Tue Jan 09, 2007 04:02 AM
Mr. Rochinha.

Thank's for replay
 ADORDDDefault( "MySQL" ) 

    StrConnection := "driver={" + StrDriver +"}" + ";database=" + StrDatabase + ; 
                     ";server=" + StrServer + ; 
                     ";uid=" + StrUserID + ; 
                     ";pwd=" + StrUserPWD + ; 
                     ";option=3;" 

    ADO CONNECT StrConnection 
    if .not. ADOConnected() 
       ? "Conexao nao foi estabilizada. Aplicativo sera fechando." 
       return .f. 
    endif 
    ADO USE clientes 
    ADO USE proposta 

    MainBrowse() 

    ADO CLOSE

@ 0,205 LISTBOX oLbx2 FIELDS SIZE 300,200 PIXEL OF oWnd 
           oLbx2:bLine         := {|| { str(ADOField( "idfilial" ),5), ; 
                                        str(ADOField( "idproposta" ),6), ; 
                                        LoadResources(MostraStatus(ADOField("status"))), ; 
                                        ADOField( "nome" ), ; 
                                        alltrim(ADOField( "marca" ))+"-"+ADOField( "modelo" ), ; 
                                        ADOField( "cic" ), ; 
                                        transf( ADOField( "financiado" ), "@e 999,999.99" ), ; 
                                        transf( ADOField( "entrada" ), "@e 999,999.99" ), ; 
                                        transf( ADOField( "prazo" ), "@e 999,999.99" ), ; 
                                        transf( ADOField( "parcela" ), "@e 999,999.99" ) } }

I don't have any function for all ADO
Where is it ?

Regards
Areang

Continue the discussion