Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Tablas planas
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 01-10-2007
Avatar de papulo
papulo papulo is offline
Miembro
 
Registrado: ago 2005
Ubicación: Lleida - Cataluña - España -Europa - Planeta tierra - Sistema solar - Via Lactea ...
Posts: 542
Poder: 19
papulo Va por buen camino
Acceder fichero Access desde otro equipo con Ubuntu vía ODBC

El tema es el siguiente,

un ordenador de la LAN tiene una DB en access y el servidor que acabamos de montar es Ubuntu. Tengo que hacer un script en PHP para acceder a dicha DB, y me gustaría usar ODBC.

El caso es que no se por donde empezar, dado que tengo que crear un Driver DSN para poder usarlo en el script.

No se como montarlo, pero ni la mas remota idea, porque en windos está fácil, pero en Ubuntu estoy mirando IODBC y cosas así, pero no saco nada en claro.

Socorro

Gracias.
__________________
"El aprendizaje potencia la intuición"
Yo mismo, en un momento de inspiración. v2.0
Responder Con Cita
  #2  
Antiguo 01-10-2007
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.040
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Seguro que has visto esto:
http://lists.badopi.org/pipermail/co...12/015792.html
Yo diría que está en catalán, pero no creo que sea problema para tí.
Es lo único que he encontrado
Espero que te sirva de algo.
Responder Con Cita
  #3  
Antiguo 03-10-2007
Avatar de papulo
papulo papulo is offline
Miembro
 
Registrado: ago 2005
Ubicación: Lleida - Cataluña - España -Europa - Planeta tierra - Sistema solar - Via Lactea ...
Posts: 542
Poder: 19
papulo Va por buen camino
Gracias por la respuesta, amigo, pero por el propio diseño del Access, no se puede acceder de forma remota a través del ODBC.

De todas formas, encontré este documento, que supongo servirá a quienes quieran acceder a un fichero MDB en linux.

El enlace de donde lo saqué

Fusilaré el texto para que si se cae la página, podamos acceder a la valiosa información:

Cita:
Empezado por Fusilo de una página

You will need the following:
Linux ( I’m running RedHat 9.0)
PHP
Apache
UnixODBC
MDBTools

INSTRUCTIONS
1) Download the UnixODBC RPM, found here. I installed unixODBC version 2.2.5.1.
rpm -ivh unixODBC-2-2.5-1.i386.rpm
2) Download the MDBTools rpm, found here. I installed mdbtools version 0.5.1. Read limitations!
rpm -ivh mdvtools-0.5-1.i386.rpm
3) Download the MDBTools ODBC driver rpm. Again I installed version 0.5-1.i386.rpm. Read limitations!
rpm -ivh mdbtools-odbc-0.5-1.i386.rpm
4) Add the mdbtools driver to your unixODBC config.
Create a new text file. NON-LINUX user: Beware do not do this on windows as you might get werid new lines, use vi.

[MDBToolsODBC]
Description = MDB Tools ODBC drivers
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage = 1
CPTimeout =
CPReuse =

NOTE: The driver may be in /usr/local/lib/libmdbodbc.so.0. This happens if you build from source and use the make install command. The RPM puts it in /usr/lib.
Now install the driver using the file you created. This is called a template file.
odbcinst -i -d -f template.file
5) Define the datasource name. This is done in the /etc/odbc.ini file. So pull up this file in vi or another text editor and add the following lines.

[Dogs]
Description = Microsoft Access Database of Dogs
Driver = MDBToolsODBC
Database = /var/data/my_dog_db.mdb
Servername = localhost
UserName =
Password =
port = 5432

That’s it you should now have an odbc connection available. I will demonstrate using php, this assumes that your php is compiled with UnixODBC support, the version that ships with Redhat 9 does if yours does not then you can learn how here.
So I will write a quick php script to query my dogs database and print out the names and weights of my dogs.

$myDB = odbc_connect(”Dogs”,”",”");
$query = “select name, weight from dog_list”;
$result = odbc_exec($myDB, $query);
while (odbc_fetch_row($result)) {
print “Name = ” . odbc_result($result,”name”);
print “
Weight = ” . odbc_result($result,”weight”);
}

If you get a php error that says odbc_connect is not a function then see if you have php-odbc installed. Do rpm -qa php-odbc. If you see php-odbc returned then you have it if not install it., the rpm is available on the redhat discs.

Limitations:
- As of the time of writing this entry MDBTools did not support write access to the mdb files. This was fine for my purposes as I was reading data in and sticking it into a mysql database.
- There is a bug in MDBTools v0.5 which does not allow you to query tables or columns with an underscore. This was a bug I hit early on, but it has been fixed in new version 0.6 but that has not been released as of the time of writing this article. So I recompiled the 0.5 source code with the fix from the 0.6 CVS repository. I have bundled it into a 0.5 release and have the two rpms mentioned above here:
mdbtools-0.5-1.i386.rpm
mdbtools-odbc-0.5-1.i386.rpm
I would check the official download site before using my hacked version as I’m sure this bug will be fixed in 0.6 (plus rumor has write access will be present as well).
References:
Using UnixODBC from command line
Installing MDBTools

Remarcar, que yo seguí el proceso desde ubuntu 7.04 vía synaptic y no tuve problema instalando lo que pedía.

El archivo de configuración y lo demás funciona tal cual.

Espero que sirva a alguien mas, que me pegué la de dios buscandolo.

Saludooos.
__________________
"El aprendizaje potencia la intuición"
Yo mismo, en un momento de inspiración. v2.0
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Insertar registros desde un fichero gdb a otro gdb glopez Firebird e Interbase 1 08-02-2006 02:04:39
Acceder A Fichero Dat/idx Desde Delphi roberdevigo Conexión con bases de datos 1 23-08-2005 18:39:25
Acceder a otro ordenador desde internet Novás Redes 8 06-06-2005 17:20:46
acceder a un fichero desde un CGI Toni Internet 2 11-03-2005 14:48:00
Conectar a access desde otro pc davezf Conexión con bases de datos 6 08-01-2005 01:24:43


La franja horaria es GMT +2. Ahora son las 18:01:39.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi