Hi Sebastian,
 
I think there are two ways for ODBC'ing from Pharo:
 
 1. one is the one included in DBXTalk, I think I had this running also in the past and added
     the glorp adaptor for ODBC. Cant remember why I switched to 2.  
 
 2. the ODBC package (on top of FFI) that you can load from the Config browser in Pharo 3.0
     This one is based on the ODBC known from Squeak (http://wiki.squeak.org/squeak/2480)

Try it with the second first. You have to open the ODBC settings panel in Windows first,
and then connect to the DB by creating a system wide DSN name
similar to what is explained here for Oracle:
http://www.rpi.edu/datawarehouse/dw-brio-oce-stu-prod.html

You have to choose the correct MSSQL server driver. Then use this name for the connection in Smalltalk.
If the connection fails try with a 
database viewer tool first. 

In detail:
  1. Use a new Pharo 3.0 as from the website first.
  2. Install "ODBC" from the config browser (this will install requirements like FFI automatically)
  3. Install "OSWindows" from config browser
  4. Evaluate 
         
WinControlPanel showODBCSettings
      to open the ODBC panel
  5. Click on the "System DSN" tab there
  6. Click "Add"
  7. Select the SQL Server driver (usually "SQL Server Native Client blah"), click Next
  8. Enter an unused DSN name like "MYAPP_DB", also enter the IP address (xxx.xxx.xxx.xxx)
     of the server and go Next  (no need for port as SQLServer usually runs on 1433)
  9. Authentication depends on installation. Usually one uses the SQL Server authentication, either with
      a dedicated user connection administrated in SQL Server Tools or by default the user is something
      with "sa" (for system administrator) 
10. After login you should be able to select the database and test connection right in the ODBC control panel
11. Go back to Pharo and run some query:
    
| con results |
Transcript open.
con := ODBCConnection dsn:'MY_SYSTEM_DSN_NAME' user: 'db_user' password: 'secretOne'.
results := (con query: 'select * from MyApp.dbo.MyTable') execute.
results do:[:row | Transcript show: row; cr].
con close.

Try the query with a database tool first. If the query works from ST you can either use this or try your luck
with DBXTalk and ODBC. Hope this helps.
 
Bye
T.
 
 
Gesendet: Freitag, 19. September 2014 um 21:00 Uhr
Von: "Sebastian Sastre" <sebast...@flowingconcept.com>
An: "Pharo Development List" <pharo-dev@lists.pharo.org>
Betreff: Re: [Pharo-dev] How production ready is Pharo on SQLServer?
On Sep 19, 2014, at 8:05 AM, Torsten Bergmann <asta...@gmx.de> wrote:
 
In the end I used ODBC package as it is easy to load from the config browser and one only has
to setup an ODBC name
 
After installing all and getting things sorted, it rejects my connection. Triplechecked, network settings, server and client with tcp enabled, everything but can’t connect.
 
So I guess is time to try ODBC.
 
but odbc has no host:port, what should I do about connection settings?
 
I how do I make a DBXConnection based in an odbc one?
 
thanks!
 

Reply via email to