Hi Milo,

Yep, isn't that just great !! I tried the same when I was trying to figure
out how to bulid this Server Link statement. The MapBasic window is great,
but sometimes it would be nice if it told the whole truth in stead of these
hidden variables !!!

I did though figure out how to do it (please note that this is a Progress
database, but I guess the Oracle OCI is somewhat the same.

I created a procedure that makes the connection and gives me a
mnConnectionID (modular variable). This Id is used whenever I want to
retrieve data from the database.

'****************************************
' Connecting to Progress
'****************************************
Sub OpenConnectionToProgress

Dim  szToolKitStr, szConnectionStr As String

     OnError GoTo ErrorOccured

     If mnConnectionID = 0 Then
          '**Note this is specific Progress. Note that the user id and
password is used here.
          szConnectionStr
= "DSN=DTDDATA;HOST=localhost;PORT=2510;DB=mydatabase;UID=WHATEVER;PWD=FORMYEYESONLY"
          szToolKitStr   = "ODBC"

          mnConnectionID = Server_Connect(szToolKitStr, szConnectionStr)
     End If

     OnError GoTo ErrorNoConnection
     Print "Connection Made. ConnectionID: " + mnConnectionID

     Exit Sub
'--------------------
ErrorOccured:
     Note "Error: " + Error$()
     Exit Sub

'--------------------
ErrorNoConnection:
     mnConnectionID = 0

     If Ask("Error Connecting. Retry?", "Yes", "No") Then
          Call OpenConnectionToProgress
     End If

End Sub

Here is an example on how to "select" data from the progress database

'****************************************
' Opening the table MIHUSSTAND from the Progress database
'****************************************
Sub OpenMIHusstandFromProgress

     OnError GoTo ErrorOccured

     If OpenTableFromProgress("MIHUSSTAND") Then
          Browse * From MIHUSSTAND
     Else
          Note "Error opening the table MIHUSSTAND"
     End If

     Exit Sub
'--------------------
ErrorOccured:
     Note "Error: " + Error$()

End Sub

'****************************************
' Opening a table from Progress
'****************************************
Function OpenTableFromProgress(ByVal szTab As String) As Logical

Dim  szToolKitStr, szSelect As String

OpenTableFromProgress = FALSE

     OnError GoTo ErrorOccured

     If TableOpen(szTab) Then
          Close Table szTab
     End If

     '**Again: Specific Progress
     szToolKitStr   = "ODBC"
     szSelect       = "Select *  From ""PUB""." + Chr$(34) + szTab + Chr
$(34)

     Print szSelect

     Server mnConnectionID Link Table szSelect
          Toolkit szToolKitStr
          Into szTab
          File "D:\DTD\Progress\" + szTab + ".TAB"
          ReadOnly

OpenTableFromProgress = TRUE

     Exit Sub
'--------------------
ErrorOccured:
     Note "Error: " + Error$()

End Function
'
*********************************************************************************

I'm still in the start fase so I haven't quite figues out how to do this
the smartest way from within MapBasic, but soon I'll know, hopefully ;-)

I hope this helps!

Peter
------------------------------------------------------------------------------------------------

Peter Horsb�ll M�ller, GIS-Developer
Kampsax A/S, GIS Software & Solutions, Rugaardsvej 55, DK-5000 Odense,
Denmark
tlf: + 45 63 13 50 13, dir: + 45 63 13 50 08, fax: + 45 63 13 50 90
mail: [EMAIL PROTECTED], http://www.mapinfo.dk, http://www.kampsax.dk
------------------------------------------------------------------------------------------------




                                                                                       
                                            
                    Milo van der Linden                                                
                                            
                    <[EMAIL PROTECTED]>         Til:    
[EMAIL PROTECTED]                                 
                    Sendt af:                            cc:                           
                                            
                    [EMAIL PROTECTED]        Vedr.:  MI-L Server Link 
Table                                            
                    onsmag.com                                                         
                                            
                                                                                       
                                            
                                                                                       
                                            
                    06-08-2001 16:09                                                   
                                            
                    Besvar venligst til Milo van                                       
                                            
                    der Linden                                                         
                                            
                                                                                       
                                            
                                                                                       
                                            



List,

I want to access a Server Link Table (OCI) from a
MapBasic application. I tried to capture the required
commands from a mapbasic window in MapInfo, it states
the following:

Dim __ODBC_CONSTRING__ as String
Dim __ODBC_TOOLKIT__ as String
Server Link Table __ODBC_QUERY__ Using
__ODBC_CONSTRING__ toolkit __ODBC_TOOLKIT__ Into
"TABCAB" File "C:\vb\Ignitenetwork\Data\TABCAB.TAB"
Undim __ODBC_QUERY__
Undim __ODBC_TOOLKIT__
Undim __ODBC_CONSTRING__
Add Map Auto Layer TABCAB

Which variable should hold which value? When I try the
Server link the way it is defined in MapBasic help, it
constantly prompts me for the connection parameters to
Oracle (Username, Pwd, ServerName). This is not what I
want to bother my users with.

Anyone got an answer to this one?

Thanx!




=====
Ing. M.F. (Milo) van der Linden
NetGIS
kvk. 30166407
ABN Amro 57.64.10.535
NL - 3437TT  NIEUWEGEIN
+31(0)616598808

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.






_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to