connect to mysql server

Post Reply
areang
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

connect to mysql server

Post by areang »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: connect to mysql server

Post by Enrico Maria Giordano »

areang wrote:how to connect this php on FWH
Try using ADO. You can find the connection string on:

http://www.connectionstrings.com

EMG
areang
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Post by areang »

Thank's Enrico

Could you mind to give me example ?

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

Best Regard
Areang
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

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:

Code: Select all

   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.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
areang
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Post by areang »

Mr. Enrico

Thank's for help

Regards
Areang
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

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:

Code: Select all

    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():

Code: Select all

   @ 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.
areang
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Post by areang »

Mr. Rochinha.

Thank's for replay

Code: Select all

 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
Post Reply