expert of ADS and Harbour

expert of ADS and Harbour

Postby lucasdebeltran » Fri Mar 23, 2012 10:01 am

Hello,

Please, who are the exports of ADS and Harbour?.

Thank you.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby lucasdebeltran » Sun Mar 25, 2012 7:55 pm

Hello,

I have a problem with AIS and free tables.


I am able to use and work with DBFS and AIS when tables are
incorporated into a Data Dictorionary. There is no problem about that.


But in our software we have so many companies and each one has a
specific folder with all the dbfs and indexes (CUSTOMERS, INVOICES,
ITEMS, ...).


So that´s why I am looking to use free tables.


I am able to create a free table with dbcreate():


i := dbCreate( ("\\my ip:2400\lucas\newtable"),{ { "FNUMERO" ,
"N", 20, 0 }, ;
{ "FCODIGO" , "C", 20, 0 }, ;
{ "FPARCIAL2" , "N", 24, 10 } } )



Also, I am able to delete a file:


AdsDeleteFile("C:\LUCAS\ALBARAN1.DBF")



But I can´t open the table in AIS as:


USE "C:\LUCAS\ALBARAN1" or USE "\\my ip:2400\LUCAS\ALBARAN1"


In both cases, I get:


Error ADSCDX/5132 The specified database object name is not valid.: C:
\LUCAS\ALBARAN1.DBF


At sybase forums, they said it is possible to use free tables via AIS.


In this post, Rene Flores says it is a bug and it worked as I pretend
in previous xHarbour builds (with xharbour 0.99.3 and previous):
viewtopic.php?f=6&t=6819


So, I am able to deal with free tables under AIS just with dbCreate
and AdsDeleteFile.


But USE or AdsCheckExistence fail.


Is there any solution to solve the bug?.


Thank you very much for your help.

Best regards,


Lucas
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby frose » Mon Mar 26, 2012 11:37 am

Lucas,

no problem to open free tables.

If you are using xHarbour, you can even establish connections to different servers and open tables on these servers, see sample:
Code: Select all  Expand view  RUN

   // ALS connection
   IF AdsConnect60( cPathLoc, ADS_LOCAL_SERVER, "ADSSYS",, 0, @nHandLoc) == .F.
      nError:=AdsGetLastError(@cError)
      ? cError
      return NIL
   ENDIF
   
   // Open a dbf
   // DbUseArea( [<lNewArea>], [<cRddName>], <cDatabase>, [<cAlias>], [<lShared>], [<lReadonly>], [<cCodePage>], [<nConnection>] )
    DbUseArea( .T., "ADSCDX", cPathLoc + "PRMTR.DBF", "prm_loc", .T.,,, nHandLoc )
   
   // ADS connection
   IF AdsConnect60( cPathRem, ADS_REMOTE_SERVER, "ADSSYS",, 0, @nHandRem) == .F.
      nError:=AdsGetLastError(@cError)
      ? cError
      return NIL
   ENDIF
   
   // Open a dbf
    DbUseArea(            .T.,     "ADSCDX", cPathRem + "PRMTR.DBF", "prm_rem",         .T.,              ,              , nHandRem )

   // Check if ADS or ALS is running
   lADS := AdsConnect( cPathRem ) // -> .T.
   lADS := AdsConnect( cPathLoc ) // -> .F.
 
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: expert of ADS and Harbour

Postby lucasdebeltran » Mon Mar 26, 2012 4:22 pm

Frank,

Thank you.

But using AIS via Internet it gives:

DbUseArea( .T., "ADSCDX", "C:\LUCAS\CONTA.DBF", "LUCAS" )

Error ADSCDX/5132 The specified database object name is not valid.: C:\LUCAS\CONTA.DBF
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby carlos vargas » Mon Mar 26, 2012 5:44 pm

hay que entender que la conexion en AIS se hace a traves de socket, por ello no funcionan algunas intrucciones que hacen referencia al disco duro
funciones como dbcreate, file no funcionaran, por que no tienes acceso directo al disco del server.
DbUseArea( .T., "ADSCDX", "C:\LUCAS\CONTA.DBF", "LUCAS" )

aca tu estas intentando usar una tabla alojada en c:\lucas lo cual no es posible.

es posible crear tablas en el servidor con la intruccion create table, o modificar tablas con alter tables, y en casos puntuales, crear tablas usando los drivers
dbfcdx o dbfntx para se usados de forma local en la pc cliente.

incluso tanto harbour como xharbour permiten usar tablas en memoria o tablas temporales,
Code: Select all  Expand view  RUN

dbcreate( "mem:FICHA1", aEstructura , "DBFCDX" )
...
HB_DBCreateTemp( "FICHA1", aEstructura , "DBFCDX" )
 



salu2
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: expert of ADS and Harbour

Postby edmundogarcia32 » Mon Mar 26, 2012 6:02 pm

The location of the Internet-enabled Advantage Database Server must be specified. In addition, you must also configure your application to use the Advantage Internet Server server type. See Connecting Clients through the Internet to Advantage for details. Below are the three ways to specify the location of the Internet-enabled Advantage Database Server:

1. Use the server's IP address and Internet port number in the connection path string. The path can be specified as \\<ip address>:<ip port>\share\Dir\DataDictionary.add, where the <ip address> is the IP address where the Advantage Database Server is located, and the <ip port> is the Internet Port that the Advantage Database Server is listening.

Example of using the server’s IP address and Internet port number with the Advantage Client Engine API:

ulRetVal = AdsConnect60("\\\\193.69.232.1:6262\\share1\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );

Similar functionality for specifying the IP address and port in the connection string/path is available in other Advantage clients. The details related to making a connection through the Internet to the Advantage Database Server from other clients can be found in the respective Advantage client Help documentation.

2. Specify the server name in the connection string. The path can be specified as \\<server name>\share\Dir\DataDictionary.add, where the <server name> is the name of a server specified in the ADS.INI file. The ADS.INI file specifies the actual IP address where the Advantage Database Server is located, and IP port that the Advantage Database Server is listening, that correspond to the specified server name. See Setting Up Your Clients Using ADS.INI for more specifics on information in the ADS.INI file.

Example of using a server name with the Advantage Client Engine API:

ulRetVal = AdsConnect60( "\\\\server1\\share1\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );

3. Specify a drive letter in the connection string. The drive letter can be specified as <x:>\Dir\DataDictionary.add, where the <x:> is the name of a drive letter specified in the ADS.INI file. The ADS.INI file directly or indirectly specifies the actual IP address where the Advantage Database Server is located, as well as the IP port that the Advantage Database Server is listening, that correspond to the specified drive letter. See Setting Up Your Clients Using ADS.INI for more specifics on information in the ADS.INI file.

Example of using a drive letter with the Advantage Client Engine API:

ulRetVal = AdsConnect60( "x:\\test.add",
ADS_AIS_SERVER,
"User1",
"foobar",
ADS_DEFAULT,
&hConnect );

The Advantage Internet Server configuration can be specified in the ADS.INI file by adding a couple of sections.
The [Drives] section lists the complete UNC path to which a drive letter is mapped. If your client application uses drive letters, you will need to define the drive letter mappings.
Example:

[ Drives ]
R:=\\SERVER1\SHARE

For each Advantage Database Server you want to connect to, you will need to have a separate server-name entry.
Example:

[ <server name> ]
INTERNET_PORT=<the Internet port for the server>
INTERNET_IP=<the IP address for the Advantage Database Server>

Example:

[Drives]
Q:=\\serverA\testsys\
r:=\\serverB\data\
[serverA]
INTERNET_PORT=2001
INTERNET_IP=198.169.1.69
[serverB]
INTERNET_PORT=2002
INTERNET_IP=198.70.169.72


Taken from the ADS help file, finally, when you open the database with the USE command, use the network drive, must be the same that setup in the ini file

Regards
Edmundo
edmundogarcia32
 
Posts: 7
Joined: Wed Sep 01, 2010 5:29 am

Re: expert of ADS and Harbour

Postby lucasdebeltran » Mon Mar 26, 2012 6:19 pm

Thanks for reply.

Edmundo, did you try yourself?.


Carlos, some commands work other not.


I am able to create a free table with dbcreate():


i := dbCreate( ("\\194.224.200.2:2400\lucas\newtable"),{ { "FNUMERO" ,
"N", 20, 0 }, ;
{ "FCODIGO" , "C", 20, 0 }, ;
{ "FPARCIAL2" , "N", 24, 10 } } )


Also, I am able to delete a file:


AdsDeleteFile("C:\LUCAS\ALBARAN1.DBF") or
or AdsDeleteFile("\\194.224.200.2:2400\LUCAS\ALBARAN1") works too.


But I can´t open the table in AIS as:

USE "C:\LUCAS\ALBARAN1" or USE "\\194.224.200.2:2400\LUCAS\ALBARAN1" or dbusearea()


In both cases, I get:

Error ADSCDX/5132 The specified database object name is not valid.: C:
\LUCAS\ALBARAN1.DBF


At sybase forums, they said it is possible to use free tables via AIS.


In this post, Rene Flores says it is a bug and it worked as I pretend
in previous xHarbour builds (with xharbour 0.99.3 and previous):
viewtopic.php?f=6&t=6819




This is a full working sample:

Code: Select all  Expand view  RUN
#include "ads.ch"
#define CRLF Chr(13)+Chr(10)


Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo,
AdsGetRelKeyPos, AdsSetRelKeyPos


//-------------------------------------------------------------------------­---//
 

function Main()


     local aArray := {}, cDbf, i


     RddRegister( "ADS", 1 )
     RddSetDefault( "ADS" )


     //setting up server type
     // 1 = Local Server (no client / server)
     // 2 = Remote Server
     // 3 = Local + Remot
     // 4 = Internet Server
     // 5 = Local + Internet
     // 6 = Remote+Internet
     // 7 = Local + Remote + Internet , best choice
     adsSetServerType( 4 )  // ó
adsSetServerType( ADS_REMOTE_SERVER )


     //setting up the file types
     // 1 = DBFNTX
     // 2 = DBFCDX
     // 3 = ADSADI
     adsSetFileType( ADS_CDX )


     AdsRightsCheck(.F.)


   IF AdsConnect60( "\\194.224.200.2:2400\lucas\lucas.ADD",
4 ,"massimo","")


   //    MsgInfo("Esta ahora conectado al Sevidor AIS "+CRLF+CRLF+;
    //     "You are now connected to AIS Server","Bienvenido /
Welcome / Versión "+ADSVersion())


   ELSE


      alert("
Se ha rechazado la conexión al servidor AIS, por favor
intente mas tarde"+CRLF+CRLF+;
         "
Conection to AIS Server rejected, please, try again later")


      alert( "
Error:"+cValtochar( AdsGetLastError() )+CRLF +;
            "
Servidor:", "Usuario" )
      QUIT


   ENDIF


   i :=  dbCreate( ("
\\194.224.200.2:2400\LUCAS\MASSIMO"),
{ { "
FNUMERO"   , "N", 20, 0 }, ;
                                   { "
FCODIGO"   , "C", 20, 0 }, ;
                                   { "
FPARCIAL2" , "N", 24, 10 } } )


   Alert(i)   // I GET .T.


   use \\194.224.200.2:2400\LUCAS\MASSIMO.DBF new
   // i get ADSCDX/5132  The specified database object name is not
valid.: \\194.224.200.2:2400\LUCAS\MASSIMO


   browse()


   alert(AdsDeleteFile("
\\194.224.200.2:2400\LUCAS\MASSIMO.dbf") )  //
I GET .T.


   alert(AdsDeleteFile("
c:\lucas\oterfile.dbf") )  // I GET .T.


   dbcloseall()
   quit


return nil





So the behaviour of ADSRDD is inconsistent.


Best regards,
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby frose » Tue Mar 27, 2012 1:40 pm

Lucas,

yes, you can't use AIS with free tables.

How you want to configure the 'The security level' without a database (Advantage Data Dictionary), so CATCH 21 :(

So, if you still want to use free tables via Internet, set up a VPN infrastructure and use ADS!
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: expert of ADS and Harbour

Postby carlos vargas » Tue Mar 27, 2012 6:16 pm

lucas me interesa contactar contigo,

mi email es donboscocorp2@hotmail.com

salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: expert of ADS and Harbour

Postby lucasdebeltran » Tue Mar 27, 2012 7:35 pm

Frank,

Thank you. Your idea works ;).

I am having trouble with indexes and Data Dictorionary. I create the indexes as INDEX ON FIELD TO INDEXNAME but AIS ignores that.

I think working with a Data Dictionary you need to reindex using AdsReindex(), not INDEX ON command... I´m not sure,


Carlos, I sent you an email.


Thank you very much.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby carlos vargas » Tue Mar 27, 2012 9:23 pm

EXECUTE PROCEDURE sp_CreateIndex90(
'caja',
'caja.adi',
'NUM_CIUD',
'num_ciud',
'',
2,
512,
'' );
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: expert of ADS and Harbour

Postby lucasdebeltran » Mon Apr 02, 2012 5:37 pm

Thank you, but I need to create the indexes on .prg side, not ARC.

I also need several indexes.

This code works perfect in ADS remote, local or DBCDX but not in AIS:

// Todas las series
INDEX ON FSERIE + StrZero (FNUMERO,20 ) TO (cMyPath+"FACTUR1") FOR !Deleted()
// Serie A, B
INDEX ON FSERIE + StrZero (FNUMERO,20 ) TO (cMyPath+"FACTURA") FOR (FSERIE="A") .AND. !Deleted()
INDEX ON FSERIE + StrZero (FNUMERO,20 ) TO (cMyPath+"FACTURB") FOR (FSERIE="B") .AND. !Deleted()
// Cobrada
INDEX ON FSERIE + StrZero (FNUMERO,20 ) TO (cMyPath+"FACTURC") FOR FCOBRADA="S" .AND. !Deleted()
INDEX ON FSERIE + StrZero (FNUMERO,20 ) TO (cMyPath+"FACTURN") FOR FCOBRADA!="S" .AND. !Deleted()
DbCloseAll()


Any clude, Thank you very much,
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: expert of ADS and Harbour

Postby fraxzi » Tue Apr 03, 2012 12:21 am

Dear Lucas,

If you are using ADS all-the-way, you might as well consider the SQL related functions in creating your indexes..

Create a function to pass parameter similar to this:

Code: Select all  Expand view  RUN


cSQL := "CREATE INDEX index1 ON table1 ( field1 ); "           + CRLF +;
       "CREATE INDEX index2 ON table1 ( field2, field3 ); "
...
IF AdsCreateSQLStatement( cAlias, ADS_ADT, hADSConnection )
   IF (lOK := ADSExecuteSQLDirect( cSQL ) )
       ...
   ENDIF
ENDIF
...
 


just my two cents.. and dont forget to set AUTOOPEN and AUTORDER to .T....
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: expert of ADS and Harbour

Postby lucasdebeltran » Tue Apr 03, 2012 8:02 am

Helo Frances,

Thank you very much for all your help.

The problem is the conditions on the indexes:

Code: Select all  Expand view  RUN
// Todas las series
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR1 FOR !Deleted()

         // Serie A, B y R
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR2 FOR FIELD->FSERIE="A" .AND. !Deleted()
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR3 FOR FIELD->FSERIE="B" .AND. !Deleted()
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR4 FOR FIELD->FSERIE="R" .AND. !Deleted()
         // Cobrada
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR5 FOR FIELD->FCOBRADA="S"   .AND. !Deleted()
         INDEX ON FIELD->FSERIE + StrZero (FIELD->FNUMERO,20 ) TO FACTUR6 FOR FIELD->FCOBRADA!="S"  .AND. !Deleted()
         DbCloseAll()
 



Indexes are created. But they are not added in my order (FACTUR1, FACTUR2, ..). They are in a different order (2,6,4...):
http://imageshack.us/photo/my-images/189/errorads.png/


I also tried with no luck:
msgalert(AdsDDaddTable("FACTUR1", ".\idx\FACTUR1", "FACTUR1;FACTUR2;FACTUR3;FACTUR4;FACTUR5;FACTUR6" )) //, ".\idx\factur1;.\idx\factura"), "add table")

The order is still different, not FACTUR1, FACTUR2,....


So I don´t know what is wrong.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am


Return to FiveWin for Harbour/xHarbour

Who is online

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