Examples of Garage for DB2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Examples of Garage for DB2

Andrei Stebakov
I need to be able to navigate DB2 connection.
As we discussed it a few days ago on the mailing list, the suggestion was to use Garage.
I downloaded Garage to my Pharo 6.1 on windows. But in Garage I only see drivers for MySql, Postgres and Sqlite3.
Does it mean that for DB2 I should look somewhere else or there is a way to create a connection for DB2 using existing Garage functionality?
If there is a way, could you send some example?

Thanks!
Andrei
Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Pierce Ng-3
On Tue, Jan 02, 2018 at 02:10:03PM -0500, Andrei Stebakov wrote:
> I downloaded Garage to my Pharo 6.1 on windows. But in Garage I only see
> drivers for MySql, Postgres and Sqlite3.
> Does it mean that for DB2 I should look somewhere else or there is a way to
> create a connection for DB2 using existing Garage functionality?

Garage uses the OpenDBX C language database access library underneath.  Looking
at https://linuxnetworks.de/doc/index.php?title=OpenDBX/Support, it doesn't
look OpenDBX supports DB2.

Does the Windows DB2 ODBC driver work? Does Pharo successfully use the ODBC
driver to talk to DB2?

Pierce

Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Andrei Stebakov
Pierce, I couldn't find any smalltalk framework to work with DB2 at this point. I couldn't also find any Pharo odbc library. That's why at this point I am looking for any ideas how to connect to DB2 from Pharo.

On Jan 3, 2018 09:52, "Pierce Ng" <[hidden email]> wrote:
On Tue, Jan 02, 2018 at 02:10:03PM -0500, Andrei Stebakov wrote:
> I downloaded Garage to my Pharo 6.1 on windows. But in Garage I only see
> drivers for MySql, Postgres and Sqlite3.
> Does it mean that for DB2 I should look somewhere else or there is a way to
> create a connection for DB2 using existing Garage functionality?

Garage uses the OpenDBX C language database access library underneath.  Looking
at https://linuxnetworks.de/doc/index.php?title=OpenDBX/Support, it doesn't
look OpenDBX supports DB2.

Does the Windows DB2 ODBC driver work? Does Pharo successfully use the ODBC
driver to talk to DB2?

Pierce

Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Pierce Ng-3
On Wed, Jan 03, 2018 at 10:12:32AM -0500, Andrei Stebakov wrote:
> Pierce, I couldn't find any smalltalk framework to work with DB2 at this
> point. I couldn't also find any Pharo odbc library. That's why at this
> point I am looking for any ideas how to connect to DB2 from Pharo.

I suppose Instantiations VA Smalltalk will be able to talk to DB2. I'm quite
sure Dolphin Smalltalk does ODBC too.

Staying with Pharo, assuming you have known-working DB2 ODBC driver for Windows
installed and ODBC to DB2 configured, try this:

  http://smalltalkhub.com/#!/~PharoExtras/ODBC/

Most recent commit was in Apr 2015 by Torsten 'switching to newer FFI'. So
hopefully this works with Pharo 6.1.

If the above doesn't work, but you know that the Windows DB2 ODBC driver works,
then - I'm not being facetious - install PostgreSQL, set up PostgreSQL foreign
data wrapper to ODBC, and talk to PostgreSQL using Pharo.

   http://www.postgresonline.com/journal/archives/372-ODBC-FDW-now-supports-9.5-and-9.6.html

Or, set up Python's SQL Alchemy for DB2, install PostgreSQL, set up PostgreSQL
foreign data wrapper to SQL Alchemy, and talk to PostgreSQL using Pharo.

  https://wiki.postgresql.org/wiki/Foreign_data_wrappers
  https://github.com/Kozea/Multicorn

HTH.


Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Andrei Stebakov
I tried before to install odbc.
Gofer new
  squeaksource: 'ODBC';
  package: 'ConfigurationOfODBC'; load.
  (Smalltalk at: #ConfigurationOfODBC) load.

When I execute the code above I got an exception doesNotUnderstand: #selector in RBParser>>externalFunctionDeclaration. Looks like currentScope variable is not defined.
Also if I install ODBC from the catalog it also fails.
I still don't see how postgres can help but I'll give it another try.

On Jan 3, 2018 11:05, "Pierce Ng" <[hidden email]> wrote:
On Wed, Jan 03, 2018 at 10:12:32AM -0500, Andrei Stebakov wrote:
> Pierce, I couldn't find any smalltalk framework to work with DB2 at this
> point. I couldn't also find any Pharo odbc library. That's why at this
> point I am looking for any ideas how to connect to DB2 from Pharo.

I suppose Instantiations VA Smalltalk will be able to talk to DB2. I'm quite
sure Dolphin Smalltalk does ODBC too.

Staying with Pharo, assuming you have known-working DB2 ODBC driver for Windows
installed and ODBC to DB2 configured, try this:

  http://smalltalkhub.com/#!/~PharoExtras/ODBC/

Most recent commit was in Apr 2015 by Torsten 'switching to newer FFI'. So
hopefully this works with Pharo 6.1.

If the above doesn't work, but you know that the Windows DB2 ODBC driver works,
then - I'm not being facetious - install PostgreSQL, set up PostgreSQL foreign
data wrapper to ODBC, and talk to PostgreSQL using Pharo.

   http://www.postgresonline.com/journal/archives/372-ODBC-FDW-now-supports-9.5-and-9.6.html

Or, set up Python's SQL Alchemy for DB2, install PostgreSQL, set up PostgreSQL
foreign data wrapper to SQL Alchemy, and talk to PostgreSQL using Pharo.

  https://wiki.postgresql.org/wiki/Foreign_data_wrappers
  https://github.com/Kozea/Multicorn

HTH.


Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

EstebanLM
I think if you use old compiler it will work: 

SmalltalkImage compilerClass: Compiler.

Esteban

On 3 Jan 2018, at 17:42, Andrei Stebakov <[hidden email]> wrote:

I tried before to install odbc.
Gofer new
  squeaksource: 'ODBC';
  package: 'ConfigurationOfODBC'; load.
  (Smalltalk at: #ConfigurationOfODBC) load.

When I execute the code above I got an exception doesNotUnderstand: #selector in RBParser>>externalFunctionDeclaration. Looks like currentScope variable is not defined.
Also if I install ODBC from the catalog it also fails.
I still don't see how postgres can help but I'll give it another try.

On Jan 3, 2018 11:05, "Pierce Ng" <[hidden email]> wrote:
On Wed, Jan 03, 2018 at 10:12:32AM -0500, Andrei Stebakov wrote:
> Pierce, I couldn't find any smalltalk framework to work with DB2 at this
> point. I couldn't also find any Pharo odbc library. That's why at this
> point I am looking for any ideas how to connect to DB2 from Pharo.

I suppose Instantiations VA Smalltalk will be able to talk to DB2. I'm quite
sure Dolphin Smalltalk does ODBC too.

Staying with Pharo, assuming you have known-working DB2 ODBC driver for Windows
installed and ODBC to DB2 configured, try this:

  http://smalltalkhub.com/#!/~PharoExtras/ODBC/

Most recent commit was in Apr 2015 by Torsten 'switching to newer FFI'. So
hopefully this works with Pharo 6.1.

If the above doesn't work, but you know that the Windows DB2 ODBC driver works,
then - I'm not being facetious - install PostgreSQL, set up PostgreSQL foreign
data wrapper to ODBC, and talk to PostgreSQL using Pharo.

   http://www.postgresonline.com/journal/archives/372-ODBC-FDW-now-supports-9.5-and-9.6.html

Or, set up Python's SQL Alchemy for DB2, install PostgreSQL, set up PostgreSQL
foreign data wrapper to SQL Alchemy, and talk to PostgreSQL using Pharo.

  https://wiki.postgresql.org/wiki/Foreign_data_wrappers
  https://github.com/Kozea/Multicorn

HTH.



Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Pierce Ng-3
In reply to this post by Andrei Stebakov
On Wed, Jan 03, 2018 at 11:42:22AM -0500, Andrei Stebakov wrote:
> I tried before to install odbc.
> Gofer new
>   squeaksource: 'ODBC';
   
Not Squeaksource. Load the version from Smalltalkhub:

  Gofer new
    smalltalkhubUser: 'PharoExtras' project: 'ODBC';
    ...

Hopefully this version works with or without Esteban's suggestion.

> I still don't see how postgres can help but I'll give it another try.

I suggested PostgreSQL FDW because I know PostgreSQL. If you are not familiar
with PostgreSQL, then setting it up, setting up its FDW, and finally setting up
programmatic access to PostgreSQL to get at the FDW data is probably more work
than it is worth.

Pierce


Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Andrei Stebakov
Thank you, Pierce

I got similar ffi exceptions when I call

Gofer new

  smalltalkhubUser: 'PharoExtras' project: 'ODBC';

  package: 'ConfigurationOfODBC'; load.

  (Smalltalk at: #ConfigurationOfODBC) load.


On Jan 4, 2018 11:41 AM, "Pierce Ng" <[hidden email]> wrote:
On Wed, Jan 03, 2018 at 11:42:22AM -0500, Andrei Stebakov wrote:
> I tried before to install odbc.
> Gofer new
>   squeaksource: 'ODBC';

Not Squeaksource. Load the version from Smalltalkhub:

  Gofer new
    smalltalkhubUser: 'PharoExtras' project: 'ODBC';
    ...

Hopefully this version works with or without Esteban's suggestion.

> I still don't see how postgres can help but I'll give it another try.

I suggested PostgreSQL FDW because I know PostgreSQL. If you are not familiar
with PostgreSQL, then setting it up, setting up its FDW, and finally setting up
programmatic access to PostgreSQL to get at the FDW data is probably more work
than it is worth.

Pierce


Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

EstebanLM
this: 

SmalltalkImage compilerClass: Compiler.
Metacello new 
smalltalkhubUser: 'PharoExtras' project: 'ODBC';
configuration: 'ODBC';
version: #bleedingEdge;
load.
SmalltalkImage compilerClass: OpalCompiler.

loads for me (after proceeding a warning) in Pharo7. 
no idea if it will work, but it *loads* :)

Esteban



On 4 Jan 2018, at 18:18, Andrei Stebakov <[hidden email]> wrote:

Thank you, Pierce

I got similar ffi exceptions when I call

Gofer new

  smalltalkhubUser: 'PharoExtras' project: 'ODBC';

  package: 'ConfigurationOfODBC'; load.

  (Smalltalk at: #ConfigurationOfODBC) load.


On Jan 4, 2018 11:41 AM, "Pierce Ng" <[hidden email]> wrote:
On Wed, Jan 03, 2018 at 11:42:22AM -0500, Andrei Stebakov wrote:
> I tried before to install odbc.n
> Gofer new
>   squeaksource: 'ODBC';

Not Squeaksource. Load the version from Smalltalkhub:

  Gofer new
    smalltalkhubUser: 'PharoExtras' project: 'ODBC';
    ...

Hopefully this version works with or without Esteban's suggestion.

> I still don't see how postgres can help but I'll give it another try.

I suggested PostgreSQL FDW because I know PostgreSQL. If you are not familiar
with PostgreSQL, then setting it up, setting up its FDW, and finally setting up
programmatic access to PostgreSQL to get at the FDW data is probably more work
than it is worth.

Pierce



Reply | Threaded
Open this post in threaded view
|

Re: Examples of Garage for DB2

Andrei Stebakov
Thanks, Esteban, it works in my Pharo 6.1. Odbc connection works as well.

On Jan 5, 2018 6:28 AM, "Esteban Lorenzano" <[hidden email]> wrote:
this: 

SmalltalkImage compilerClass: Compiler.
Metacello new 
smalltalkhubUser: 'PharoExtras' project: 'ODBC';
configuration: 'ODBC';
version: #bleedingEdge;
load.
SmalltalkImage compilerClass: OpalCompiler.

loads for me (after proceeding a warning) in Pharo7. 
no idea if it will work, but it *loads* :)

Esteban



On 4 Jan 2018, at 18:18, Andrei Stebakov <[hidden email]> wrote:

Thank you, Pierce

I got similar ffi exceptions when I call

Gofer new

  smalltalkhubUser: 'PharoExtras' project: 'ODBC';

  package: 'ConfigurationOfODBC'; load.

  (Smalltalk at: #ConfigurationOfODBC) load.


On Jan 4, 2018 11:41 AM, "Pierce Ng" <[hidden email]> wrote:
On Wed, Jan 03, 2018 at 11:42:22AM -0500, Andrei Stebakov wrote:
> I tried before to install odbc.n

> Gofer new
>   squeaksource: 'ODBC';

Not Squeaksource. Load the version from Smalltalkhub:

  Gofer new
    smalltalkhubUser: 'PharoExtras' project: 'ODBC';
    ...

Hopefully this version works with or without Esteban's suggestion.

> I still don't see how postgres can help but I'll give it another try.

I suggested PostgreSQL FDW because I know PostgreSQL. If you are not familiar
with PostgreSQL, then setting it up, setting up its FDW, and finally setting up
programmatic access to PostgreSQL to get at the FDW data is probably more work
than it is worth.

Pierce