connect to mysql server

connect to mysql server

Postby areang » Thu Jan 04, 2007 4: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
areang
 
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Re: connect to mysql server

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

Postby areang » Thu Jan 04, 2007 4: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
areang
 
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm

Postby Enrico Maria Giordano » Thu Jan 04, 2007 4: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
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Rochinha » 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:

Code: Select all  Expand view
   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.
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

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

Postby areang » Fri Jan 05, 2007 7:56 am

Mr. Enrico

Thank's for help

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

Postby Rochinha » Sat Jan 06, 2007 1: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:
Code: Select all  Expand view
    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  Expand view
   @ 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.
Rochinha
 
Posts: 310
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby areang » Tue Jan 09, 2007 4:02 am

Mr. Rochinha.

Thank's for replay
Code: Select all  Expand view
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
areang
 
Posts: 128
Joined: Mon Jul 31, 2006 3:23 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 71 guests