Ir al contenido


Foto

Problema cargando BD DBF de 1.7 GB


  • Por favor identifícate para responder
6 respuestas en este tema

#1 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 03 noviembre 2010 - 10:30

Pues eso, al intentar cargar (Activar y/o cargar campos persistentes) en tiempo de diseño, Delphi se queda congelada mucho tiempo y al final no termina de conectarse, no he podido abrirlo para ver los campos y/o datos de dicha tabla, he usado ADO y un componente llamado TDbf y he obtenido el mismo resultado, qué debo hacer ante esta situación??

Saludos.
  • 0

#2 cHackAll

cHackAll

    Advanced Member

  • Administrador
  • 599 mensajes

Escrito 04 noviembre 2010 - 06:25

...cargar campos persistentes...


wha?

...no he podido abrirlo para ver los campos y/o datos de dicha tabla...


Si no encuentras una solucion "común", lo comprimes con 7z y lo subes para que te una solucion extraordinaria (en ultimo caso, y si se puede, migramos).
  • 0

#3 Delphius

Delphius

    Advanced Member

  • Administrador
  • 6.295 mensajes
  • LocationArgentina

Escrito 04 noviembre 2010 - 07:22

Hola Fernando,

¿Probaste abriendo la base de datos con alguna otra herramienta? ¿Antes la base de datos ya estaba funcionando bien?

Es para descartar que sea un problema de Delphi... quizá existe la posibilidad de que la base de datos esté dañada.

Saludos,
  • 0

#4 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 05 noviembre 2010 - 10:49

Hola Chack, pues lo de persistente es un término mío y de otros :D, lo de migrarnos no será factible porque pertenece a un software que utilizan en la compañía creado en FoxPro, al intentar abrirlo con el BDE ahora me dice que esa tabla está corrupta, cosa extraña ya que el sistema que maneja esos datos se muestran perfectamente, bueno ahora mismo estoy ejecutando DBF Doctor para reparar los daños y la bendita BD tiene 213 campos !!! hostia :s, ya les contaré los resultados.

Saludos.
  • 0

#5 Delphius

Delphius

    Advanced Member

  • Administrador
  • 6.295 mensajes
  • LocationArgentina

Escrito 05 noviembre 2010 - 11:06

Hola,
Pues parece que mi presunción quizá no esté del todo errada  :p Dios no quiera que esa DB esté hecha trizas  :(

Tu lleva a ese bicho de 213 (¿no se pudieron inventar uno más  :p :D ?) campos con el doc a ver si le pone una vacuna.

Saludos,
  • 0

#6 cHackAll

cHackAll

    Advanced Member

  • Administrador
  • 599 mensajes

Escrito 10 noviembre 2010 - 07:14

...al intentar abrirlo con el BDE ahora me dice que esa tabla está corrupta, cosa extraña ya que el sistema que maneja esos datos se muestran perfectamente...


Aunque no he probado con BDE, he notado un comportamiento fastidioso usando OLEDB y ODBC en un ADOTable. En ambos casos y por una razón que no me puse a analizar, al momento de abrir la conexión con tu BD, internamente hace algún tipo de caché que consume los recursos (memoria) como si fuera un producto de Microsoft. Aunque la RAM de mi equipo debería poder albergar dicha información en cierto momento aparece un Error no especificado.

En resumen; tu BD de 1.7 Gb. no tiene ninguna falla de integridad, es un problema interno de manejo de información que se puede solucionar utilizando directamente el Driver ODBC del Visual FoxPro, tal cual el siguiente ejemplo funcional que publico para futuras implementaciones;



delphi
  1. uses Windows; // by cHackAll
  2.  
  3. // [url]http://download.microsoft.com/download/vfoxodbcdriver/Install/6.1/W9XNT4/EN-US/VFPODBC.msi[/url]
  4. // Microsoft® Visual Foxpro® ODBC Driver, v6.1 (final release) uses the ODBC 2.0 Standards Compliance;
  5. // SQLAllocEnv, SQLAllocConnect, SQLAllocStmt, SQLFreeStmt, SQLFreeConnect and SQLFreeEnv are deprecated.
  6.  
  7. function SQLAllocEnv(var hEnvironment: Integer): SmallInt; stdcall external 'vfpodbc';
  8. function SQLAllocConnect(hEnvironment: Integer; var hConnection: Integer): SmallInt; stdcall external 'vfpodbc';
  9. function SQLAllocStmt(hConnection: Integer; var hStatment: Integer): SmallInt; stdcall external 'vfpodbc';
  10. function SQLDriverConnect(hConnection, hWnd: Integer; lpInConnectionString: PChar; cbStringLength1: SmallInt; lpOutConnectionString: PChar; cbBufferLength: SmallInt; lpStringLength2Ptr: PSmallInt; DriverCompletion: Word): SmallInt; stdcall external 'vfpodbc';
  11. function SQLExecDirect(hStatment: Integer; StatementText: PChar; TextLength: Integer): SmallInt; stdcall external 'vfpodbc';
  12. function SQLNumResultCols(hStatement: Integer; ColumnCountPtr: PSmallInt): SmallInt; stdcall external 'vfpodbc';
  13. function SQLDescribeCol(hStatment: Integer; ColumnNumber: SmallInt; lpColumnName: PChar; cbBufferLength: SmallInt; NameLengthPtr, DataTypePtr: PSmallInt; ColumnSizePtr: PInteger; DecimalDigitsPtr, NullablePtr: PSmallInt): SmallInt; stdcall external 'vfpodbc';
  14. function SQLFetch(hStatment: Integer): SmallInt; stdcall external 'vfpodbc';
  15. function SQLGetData(hStatment: Integer; ColumnNumber: Word; TargetType: SmallInt; TargetValuePtr: PChar; BufferLength: Integer; StrLen_or_IndPtr: PInteger): SmallInt; stdcall external 'vfpodbc';
  16. function SQLFreeStmt(hStatment, fOption: Integer): SmallInt; stdcall external 'vfpodbc';
  17. function SQLDisconnect(hConnection: Integer): SmallInt; stdcall external 'vfpodbc';
  18. function SQLFreeConnect(hConnection: Integer): SmallInt; stdcall external 'vfpodbc';
  19. function SQLFreeEnv(hConnection: Integer): SmallInt; stdcall external 'vfpodbc';
  20.  
  21. var
  22. hEnvironment, hConnection, hStatment,
  23. Columns, hFile, Index, Size, uBytes: Integer;
  24. Buffer: array [0..1024*1024-1] of Char;
  25. lpBuffer: PChar;
  26.  
  27. begin
  28. SQLAllocEnv(hEnvironment);
  29. SQLAllocConnect(hEnvironment, hConnection);
  30. if SQLDriverConnect(hConnection, 0, 'SourceType=DBF;SourceDB=c:\MyVFPdb', -3{SQL_NTS}, @Buffer, $7F, nil, 0{SQL_DRIVER_NOPROMPT}) = 0{SQL_SUCCESS} then
  31.   begin
  32.   SQLAllocStmt(hConnection, hStatment);
  33.   SQLExecDirect(hStatment, 'select * from basediar', -3);
  34.   SQLNumResultCols(hStatment, @Columns);
  35.   hFile := 0;
  36.   repeat
  37.     Size := 0;
  38.     uBytes := 0;
  39.     lpBuffer := @Buffer;
  40.     for Index := 1 to Columns do
  41.     begin
  42.       PCardinal(lpBuffer)^ := 8748;
  43.       if hFile > 0 then SQLGetData(hStatment, Index, 1{SQL_C_CHAR}, @lpBuffer[2], SizeOf(Buffer), @Size)
  44.       else SQLDescribeCol(hStatment, Index, @lpBuffer[2], High(SmallInt), @Size, nil, nil, nil, nil);
  45.       while (Size > 0) and (lpBuffer[Size + 1] = ' ') do Dec(Size);
  46.       Inc(Size, 3); Inc(uBytes, Size); Inc(lpBuffer, Size);
  47.     lpBuffer[-1] := '"';
  48.     end;
  49.     if hFile = 0 then
  50.     hFile := _lcreat('basediar.txt', 0);
  51.     PCardinal(lpBuffer)^ := $0A0D;
  52.     _lwrite(hFile, @Buffer[1], uBytes + 1);
  53.   until SQLFetch(hStatment) <> 0;
  54.   SQLFreeStmt(hStatment, 1{SQL_DROP});
  55.   SQLDisconnect(hConnection);
  56.   end;
  57. SQLFreeConnect(hConnection);
  58. SQLFreeEnv(hEnvironment);
  59. end.



Nótese en la línea 30 del proyecto que la cadena de conexión contiene la carpeta donde se alojan los Free Tables.
  • 0

#7 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 10 noviembre 2010 - 08:40

Vaya, muchas gracias ChackAll, haré las pruebas de lugar (y)
  • 0




IP.Board spam blocked by CleanTalk.