Instalando e configurando MySQL
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
É curioso, podem comparar com o anterior.
Apesar de também ser MySQL, download do mesmo lugar, se altera a forma de instalar.
A conclusão é simples, e vale pra qualquer coisa:
Não adianta anotar exatamente como instalar, ou ter um roteiro detalhado.
E não precisa se assustar se a tela for diferente.
O importante é aprender o conceito de como funciona, ou o que precisa configurar, pra saber se virar.
Depois segue o barco com o que estiver disponível.
Apesar de também ser MySQL, download do mesmo lugar, se altera a forma de instalar.
A conclusão é simples, e vale pra qualquer coisa:
Não adianta anotar exatamente como instalar, ou ter um roteiro detalhado.
E não precisa se assustar se a tela for diferente.
O importante é aprender o conceito de como funciona, ou o que precisa configurar, pra saber se virar.
Depois segue o barco com o que estiver disponível.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Software para o servidor.
Prefiro já baixar a versão que tem 32 e 64 bits de uma vez na mesma instalação, vai servir pra qualquer Windows.
Essa próxima pergunta é sobre o aplicativo installer.
Melhor 32 bits pra rodar em qualquer lugar.
Na próxima página, só avisar que vai baixar, mas não quer se cadastrar.
Não feche o navegador, acabou a parte do servidor, mas tem mais
Prefiro já baixar a versão que tem 32 e 64 bits de uma vez na mesma instalação, vai servir pra qualquer Windows.
Essa próxima pergunta é sobre o aplicativo installer.
Melhor 32 bits pra rodar em qualquer lugar.
Na próxima página, só avisar que vai baixar, mas não quer se cadastrar.
Não feche o navegador, acabou a parte do servidor, mas tem mais
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Software para terminais.
É a mesma página anterior.
Conector ODBC
Prefiro a versão antiga, questão de costume.
Se não me engano, é a mesma usada pela ADORDD.
IMPORTANTE:
A string de conexão é diferente conforme a versão do conector ODBC.
Se usar uma versão mais atual, vai ter que pesquisar qual a string de conexão.
Isso vai ser usado depois, pelo programa.
Não tem nada a ver com a versão instalada no servidor.
É importante também, prefira a versão Installer MSI.
Motivo simples: em formato installer, já avisa ao Windows que precisará direitos de administrador.
Em rede isso é muito importante e facilita.
É a mesma página anterior.
Conector ODBC
Prefiro a versão antiga, questão de costume.
Se não me engano, é a mesma usada pela ADORDD.
IMPORTANTE:
A string de conexão é diferente conforme a versão do conector ODBC.
Se usar uma versão mais atual, vai ter que pesquisar qual a string de conexão.
Isso vai ser usado depois, pelo programa.
Não tem nada a ver com a versão instalada no servidor.
É importante também, prefira a versão Installer MSI.
Motivo simples: em formato installer, já avisa ao Windows que precisará direitos de administrador.
Em rede isso é muito importante e facilita.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Por último, importante pra mexer nas bases de dados, fazer backup e outras coisas mais, o HeidiSQL.
Isso termina a parte de software.
Só recapitulando:
- MySQL pro servidor
- Conector ODBC para terminais
- HeidiSQL pra manutenção
Isso termina a parte de software.
Só recapitulando:
- MySQL pro servidor
- Conector ODBC para terminais
- HeidiSQL pra manutenção
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
A instalação, como vão poder ver, é bem diferente do outro post.
Primeiro o servidor MySQL no servidor.
Se for pra testar, ou sem servidor, tudo bem. Pode instalar no terminal.
Aqui move da direita pra esquerda o que vai instalar.
No meu caso, versão 64 bits.
Primeiro o servidor MySQL no servidor.
Se for pra testar, ou sem servidor, tudo bem. Pode instalar no terminal.
Aqui move da direita pra esquerda o que vai instalar.
No meu caso, versão 64 bits.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Em seguida, mostra que está pronto pra configurar.
Aqui a tela já é diferente do post anterior.
Por default, mostra "máquina de desenvolvimento".
Costumo alterar para máquina servidor, pra rodar mais coisas.
A outra opção é quando o servidor é usado exclusivamente pra MySQL.
Agora só configurar senha para o servidor.
Aqui a tela já é diferente do post anterior.
Por default, mostra "máquina de desenvolvimento".
Costumo alterar para máquina servidor, pra rodar mais coisas.
A outra opção é quando o servidor é usado exclusivamente pra MySQL.
Agora só configurar senha para o servidor.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Como opção, dá pra já adicionar mais usuários.
Mais opções, se quiser diferente do padrão.
Já vai instalar o MySQL como serviço, iniciar automaticamente, e se procurar na lista de serviços do Windows, vai se chamar MySQL56.
Agora só executar a instalação.
Mais opções, se quiser diferente do padrão.
Já vai instalar o MySQL como serviço, iniciar automaticamente, e se procurar na lista de serviços do Windows, vai se chamar MySQL56.
Agora só executar a instalação.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Servidor pronto pra uso, ou quase.
Configuração adicional:
Se conexão de rede e internet forem a mesma conexão, ou pra acessar via internet, precisa liberar o MySQL no firewall.
Senão só o servidor consegue mexer no MySQL.
É na segunda coluna onde aparece o MySQL56 (mesmo nome que apareceu na configuração).
Configuração adicional:
Se conexão de rede e internet forem a mesma conexão, ou pra acessar via internet, precisa liberar o MySQL no firewall.
Senão só o servidor consegue mexer no MySQL.
É na segunda coluna onde aparece o MySQL56 (mesmo nome que apareceu na configuração).
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
HeidiSQL.
Não é obrigatório, mas é bom pra testar o servidor, fazer backup, restore, qualquer manutenção na base de dados, cadastrar usuários, etc., etc. etc.
Pode instalar em quantas máquinas for necessário: servidor, terminal
Obs. é até exagero colocar foto da instação com next, next, next, mas....
Não é obrigatório, mas é bom pra testar o servidor, fazer backup, restore, qualquer manutenção na base de dados, cadastrar usuários, etc., etc. etc.
Pode instalar em quantas máquinas for necessário: servidor, terminal
Obs. é até exagero colocar foto da instação com next, next, next, mas....
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Instalação concluída.
Aqui vém marcado pra já usar HeidiSQL.
Tudo bem já podemos usar e acessar o servidor.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
No meu caso já tinha HeidiSQL instalado. Quando removi, a lista não foi removida, então a lista já apareceu, mas tudo bem.
Agora acessar o servidor, só escolher NOVA, e colocar os dados do servidor que instalamos.
Como estou na máquina servidora, o IP 127.0.0.1 indica máquina local.
Após preencher, só clicar em abrir.
Se tudo estiver correto, está aí nosso servidor.
Pronto pra uso e funcionando.
Agora, criar um banco de dados.
Só digitar o comando SQL e clicar na seta.
Pronto, base de dados criada.
Agora o botão atualizar pra ela aparecer na tela do HeidiSQL.
Servidor instalado, testado e pronto.
Uma opção pra testar no terminal é instalar o HeidiSQL.
Assim vai ter certeza que funciona, antes de começar a mexer com programação.
Agora acessar o servidor, só escolher NOVA, e colocar os dados do servidor que instalamos.
Como estou na máquina servidora, o IP 127.0.0.1 indica máquina local.
Após preencher, só clicar em abrir.
Se tudo estiver correto, está aí nosso servidor.
Pronto pra uso e funcionando.
Agora, criar um banco de dados.
Só digitar o comando SQL e clicar na seta.
Pronto, base de dados criada.
Agora o botão atualizar pra ela aparecer na tela do HeidiSQL.
Servidor instalado, testado e pronto.
Uma opção pra testar no terminal é instalar o HeidiSQL.
Assim vai ter certeza que funciona, antes de começar a mexer com programação.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Chegamos até aqui... vamos completar....
Nos terminais, cliente odbcmysql.
Nos terminais, cliente odbcmysql.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
E já que chegamos até aqui, porque não completar.
Agora acessar pelo Harbour, sem nada pra atrapalhar.
hbmk2 test hbwin.hbc
Agora acessar pelo Harbour, sem nada pra atrapalhar.
Código: Selecionar todos
PROCEDURE Main
LOCAL cnMySql
cnMySql := MySqlConnection( "127.0.0.1", 3306, "forumpctoledo", "root", "pctoledo" )
cnMySql:Open()
cnMySql:Execute( "CREATE TABLE CLIENTE ( ID INT(10), NOME CHAR(50) ) COLLATE=latin1_swedish_ci;" )
cnMySql:Execute( "INSERT INTO CLIENTE VALUES ( 1, 'JOSE QUINTAS' ), ( 2, 'TESTE HARBOUR' ), ( 3, 'OUTRO' );" )
cnMySql:Close()
RETURN
FUNCTION MySqlConnection( cServer, nPort, cDatabase, cUser, cPassword )
LOCAL cnConnection
cnConnection:= win_OleCreateObject( "ADODB.Connection" )
cnConnection:ConnectionString := "Driver={MySQL ODBC 3.51 Driver};Server=" + cServer + ";" + "Port=" + Ltrim( Str( nPort ) ) + ;
";Option=131072;Stmt=;Database=" + cDatabase + ";User ID=" + cUser + ";Password=" + cPassword + ";Collation=latin1;"
cnConnection:CursorLocation := 3 // local recordset
cnConnection:CommandTimeOut := 120 // seconds
cnConnection:ConnectionTimeOut := 120 // seconds
RETURN cnConnection
hbmk2 test hbwin.hbc
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
Pronto.
Tabela criada pelo Harbour.
Dados cadastrados pelo Harbour.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Instalando e configurando MySQL
E também consultar.
Na tela:
d:\temp>test
1
JOSE QUINTAS
2
TESTE HARBOUR
3
OUTRO
Código: Selecionar todos
PROCEDURE Main
LOCAL cnMySql, Rs
cnMySql := MySqlConnection( "127.0.0.1", 3306, "forumpctoledo", "root", "pctoledo" )
cnMySql:Open()
Rs := cnMySql:Execute( "SELECT * FROM CLIENTE" )
DO WHILE .NOT. Rs:Eof()
? Rs:Fields( "ID" ):Value
? Rs:Fields( "NOME" ):Value
Rs:MoveNext()
ENDDO
Rs:Close()
cnMySql:Close()
RETURN
FUNCTION MySqlConnection( cServer, nPort, cDatabase, cUser, cPassword )
LOCAL cnConnection
cnConnection:= win_OleCreateObject( "ADODB.Connection" )
cnConnection:ConnectionString := "Driver={MySQL ODBC 3.51 Driver};Server=" + cServer + ";" + "Port=" + Ltrim( Str( nPort ) ) + ;
";Option=131072;Stmt=;Database=" + cDatabase + ";User ID=" + cUser + ";Password=" + cPassword + ";Collation=latin1;"
cnConnection:CursorLocation := 3 // local recordset
cnConnection:CommandTimeOut := 120 // seconds
cnConnection:ConnectionTimeOut := 120 // seconds
RETURN cnConnection
d:\temp>test
1
JOSE QUINTAS
2
TESTE HARBOUR
3
OUTRO
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/