Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Conexion a MySQL/MariaDB
- *------------------------*
- * 1) Para crear una conexión a mySQL deberá tener instalado el driver ODBC correspondiente, este se puede descargar del siguiente link: http://www.mysql.com/products/connector/odbc
- * 2) Definicion de Variables
- lcServer ="localhost" &&puede ser una ip 127.0.0.1 // 192.168.1.1
- lcUserName="elNombredelUsuario"
- lcPassword="laClavedelUsuario"
- lcDataBase="laBasedeDatoaUsar"
- * 3) Cadena de Conexion
- lcStringConnect = "DRIVER={MySQL ODBC 3.51 Driver};" + ;
- "SERVER=lcServer;" + ;
- "UID=lcUserName;" + ;
- "PWD=lcPassword;" + ;
- "DATABASE=lcDataBase;" + ;
- "OPTIONS=131329;"
- * 4) La Conexión
- SQLSETPROP(0,"DispLogin" , 3 )
- lnHandle = SQLSTRINGCONNECT(lcStringConnect)
- * 5) El Comando a ejecutar
- jnResultado = SQLEXEC(lnHandle,"select id, username from user_acl","crsUsuarios")
- * 6) Desconexion
- SQLDISCONNECT(lnHandle)
- * PD: sensible a mayusculas/minusculas para los nombres de tablas y campos
- * aconcejo instalar en MariaDB el correspondiente ODBC descargado de su sitio web.
- * OJO... Mucho OJO, si el SO es 32bits, instala ODBC de 32bits, ... No seas marmota!!!
- * url's::
- * fuente: https://comunidadvfp.blogspot.com/2006/06/vfp-y-mysql.html
- * ejemplo 1: https://comunidadvfp.blogspot.com/2014/09/navegacion-en-formularios-abm-en.html
- * ejemplo 2: https://comunidadvfp.blogspot.com/2007/06/cliente-servidor-parametrizacion-de.html
- * Instalando MySQL (sin XAMPP u otro Paquetes innecesarios): https://dev.mysql.com/doc/refman/5.5/en/windows-install-archive.html
- * Instalando MariaDB (como un verdadero development ;) ): https://mariadb.com/kb/en/library/installing-mariadb-windows-zip-packages/
- * MariaDB vs MySQL: https://mariadb.com/kb/es/mariadb-versus-mysql-features/
- #Conexion a SQL Server
- *---------------------*
- * 1) Para crear una conexión a mySQL deberá tener instalado el driver ODBC correspondiente
- * 2) IDEM
- * 3)
- TEXT TO lcStringConnect NOSHOW TEXTMERGE
- Driver={SQL Server};Server=<<ALLTRIM(lcServer)>>;Database=<<ALLTRIM(lcDataBase)>>;Uid=<<ALLTRIM(lcUserName)>>;Pwd=<<ALLTRIM(lcPassword)>>;
- ENDTEXT
- * 4) al 6) IDEM
- #Conexion a Foxpro
- *------------------*
- * Cadena de conexion:
- https://www.connectionstrings.com/visual-foxpro/
- .DBC
- lcDbc = _samples + [Tastrade\Data\TasTrade.dbc]
- lcStringConnect = [Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=] + lcDbc + [;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO]
- ? SQLStringConnect( lcStringConnect )
- Tablas Libres
- lcDbfDir = _samples + [Solution\Europa\]
- lcStringConnect = [Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=] + lcDbfDir + [;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO]
- lh = SQLStringConnect( lcStringConnect )
- ? SQLTables(lh)
- Browse
- ? SQLExec( lh, "select * from music" )
- ? SqlResult.source
- #Conexion a SQLite
- *-----------------*
- https://www.connectionstrings.com/sqlite/
- lcStringConnect ="DRIVER=SQLite3 ODBC Driver;Database=d:\mydb.db;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
- + "Uid="+lcUserName+";Pwd="+lcPassword
- #Conexion a Postgre
- *-------------------*
- https://www.connectionstrings.com/postgre/
- lcStringConnect = "Driver={PostgreSQL ANSI};Server="+lcServer+";Database="+lcDataBase+";Uid="+lcUserName+";Pwd="+lcPassword
- #Conexion a FireBird
- *-------------------*
- https://www.connectionstrings.com/firebird/
- lcCadenaConexion = "DRIVER={Firebird/Interbase(r) driver};" ;
- + "USER= " + lcUserName + ";" ;
- + "PASSWORD= " + lcPassword + ";" ;
- + "DATABASE= " + "C:\Archivos de programa\Firebird\Firebird_2_5\examples\empbuild\Employee.fdb" + ";" ;
- + "OPTIONS= 131329;
- ... y mucho mas en
- * https://www.connectionstrings.com
- * http://www.carlprothman.net/Default.aspx?tabid=81
- * http://www.devlist.com/ConnectionStringsPage.aspx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement