[Gambas-devel] Gambas & ODBC

Andrea Bortolan andrea_bortolan at ...112...
Wed Dec 29 12:03:09 CET 2004


 --- Benoit Minisini <gambas at ...1...> ha
scritto: 
> On Monday 20 December 2004 16:30, Andrea Bortolan
> wrote:
> > Hi all,
> > in the attached file you'll find the ODBC
> connector
> > for Gambas, it is based on the unixODBC framework.
> > It's still in Alpha version...
> > I was able to use it in order to connec to to my
> > iSeries (AS/400) database using the Client Access
> ODBC
> > Driver and also I connected succesfully to an
> MySQL DB
> > server.
> > I used the Gambas Database example, in the type
> field
> > put the "odbc" value, in the host field put the
> DSN
> > (created using the ODBCConfig), the Database field
> is
> > not used the user and password fields have to be
> > filled with a correct data for the connection.
> > If you have an iSeries you can try to query the
> test
> > table QIWS.QCUSTCDT that returns 12 record and 11
> > field.
> >
> > Please contact me for any question.
> > Have a nice day, Andrea.
> >
> >
> 
> I looked at your driver. Good, but I saw one
> horrible thing :-) You execute 
> the request twice to know the number of records!
> Never do that. Imagine that 
> the query returns 1 000 000 records.
No problem for an iSeries ;-)

You're right ! It is horrible ! But this happens only
if the ODBC driver doesn't return the number of rows.
This is the iSeries ODBC driver case but not the MySQL
driver.The MySQL driver returns the rows as we expect
(but this is not the ODBC standard). 
The Gambas DB allocates the memory for the results
before starting fetching rows so if the rows number is
not right I can face some problem (no rows showed). 
> 
> But, the problem with ODBC is always there: how to
> implement all the functions 
> that return the structure of the database ? I know
> there are some special 
> queries in ODBC for that, named "catalog functions".
> 
The problem with the catalog ecc. is that the
Databases behavior is different one from others, i.e.
in the DB2/400 (iSeries ex AS/400) database you cannot
create  a new database, you can create a new library
where put the tables and this is referred as
collection using the library.table or library/table
schema to address them. So the driver cannot execute a
"create new database" command, the same command can
instead work i.e. in MySQL. 
The ODBC does not provide those functions, the way you
 can implement those funcion in order to get the
database structure is to  query the database catalog
tables using the SQL but this is a common SQL query.
    
> If you want to finish the implementation of the ODBC
> driver, here is the only 
> information I have about catalog functions. I found
> them on the ODBTP site: 
> http://odbtp.sourceforge.net.
> 
I started to use the unixODBC ODBC iplementation
because many database drivers are available for this
driver manager (included the iSeries ODBC driver).
unixODBC is written using the Microsoft standard
(Microsotf created the ODBC) and I looked at the
Microsoft documentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_api_reference.asp

.
I also started to create a new Gambas modules "ODBC"
that does not leverage on the Gambas DB class, but
this seems to duplicate many things and I don't know
which it the best way in order to have an ODBC
connection...plese let me know your thought.

I started to code ODBC because I'm an iSeries
techincal pre sales and I think that many ISV can
start to deveolop their application in Linux if they
can try Gambas. But all those ISV have OS/400
customers and the way to have Linux applications that
uses the DB2/400 is  having ODBC. When this ODBC
modules will be available I  cat start to create some
seminars and documentation on how use Gambas to crate
Linux application instead VB.  


Please let me know if you have any ideas. 
Ciao, Andrea. 


> Go to the example page and search for the
> 'sqltables.php' example.
> 
> Regards,
> 
> -- 
> Benoit Minisini
> mailto:gambas at ...1...
> 
> 
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/gambas-devel
>  


		
___________________________________ 
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica
 Scaricalo ora! 
http://it.messenger.yahoo.it




More information about the Devel mailing list