Xojo Conferences
XDCMay2019MiamiUSA

OBDC database question (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Re: MDI Window dressing
Next thread: Database code example


RB Database   -   tom.russell transport.alstom.com
  OBDC database question   -   TJ Hanson
   Re: OBDC database question   -   Sean Arney
    Re: OBDC database question   -   TJ Hanson
     Re: OBDC database question   -   Sean Arney
      Re: OBDC database question   -   TJ Hanson
       Re: OBDC database question   -   Sean Arney
        Re: OBDC database question   -   TJ Hanson
         Re: OBDC database question   -   Sean Arney
          Re: OBDC database question   -   TJ Hanson
           Re: OBDC database question   -   Sean Arney

OBDC database question
Date: 08.02.06 21:56 (Wed, 8 Feb 2006 12:56:49 -0800)
From: TJ Hanson
I have the following code:

DIM App.SuperAceDB AS ODBCDatabase // declared in App

App.SuperAceDB = NEW ODBCDatabase
App.SuperAceDB.DataSource = "" // this line
should request an open file dialog box

IF App.SuperAceDB.Connect THEN
MsgBox "we are connected to SuperAce"
ELSE
MsgBox "we are not connected"
END IF

As I read the LR, the third line should generate an open file dialog
box for the user to specify the Access database file's location.
Nothing happens and control falls through to the "we are not
connected" message.

The ODBC plugin is working, else it would not have recognized the
ODBCDatabase class. The Connect returns FALSE, probably since there
is nothing to connect to.

What am I missing? Thank you, TJH


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 08.02.06 22:29 (Wed, 08 Feb 2006 15:29:52 -0600)
From: Sean Arney
> DIM App.SuperAceDB AS ODBCDatabase // declared in App
>
> App.SuperAceDB = NEW ODBCDatabase
> App.SuperAceDB.DataSource = "" // this line
> should request an open file dialog box
>
> IF App.SuperAceDB.Connect THEN
> MsgBox "we are connected to SuperAce"
> ELSE
> MsgBox "we are not connected"
> END IF
>
> As I read the LR, the third line should generate an open file dialog
> box for the user to specify the Access database file's location.
> Nothing happens and control falls through to the "we are not
> connected" message.
>
> The ODBC plugin is working, else it would not have recognized the
> ODBCDatabase class. The Connect returns FALSE, probably since there
> is nothing to connect to.
>
> What am I missing? Thank you, TJH

It works for me. It opens the DSN window for you to pick one. Try taking
out your App. References and running it, then reassign the variable if it
works. There must be something funky going on.

HTH,

-seanA

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 08.02.06 22:55 (Wed, 8 Feb 2006 13:55:05 -0800)
From: TJ Hanson
I created a whole new project with 1 window and 1 pushbutton. The
action event for the pushbutton executes:

DIM SuperAceDB AS ODBCDatabase
SuperAceDB = NEW ODBCDatabase
SuperAceDB.DataSource = ""
IF SuperAceDB.Connect THEN
MsgBox "we are connected to SuperAce"
ELSE
MsgBox "we are not connected"
END IF

and I still get the "we are not connected" message rather than a DSN
window. Is there more than one plugin necessary? TJH

On Feb 8, 2006, at 1:29 PM, Sean Arney wrote:

>> DIM App.SuperAceDB AS ODBCDatabase // declared in App
>>
>> App.SuperAceDB = NEW ODBCDatabase
>> App.SuperAceDB.DataSource = "" // this line
>> should request an open file dialog box
>>
>> IF App.SuperAceDB.Connect THEN
>> MsgBox "we are connected to SuperAce"
>> ELSE
>> MsgBox "we are not connected"
>> END IF
>>
>> As I read the LR, the third line should generate an open file dialog
>> box for the user to specify the Access database file's location.
>> Nothing happens and control falls through to the "we are not
>> connected" message.
>>
>> The ODBC plugin is working, else it would not have recognized the
>> ODBCDatabase class. The Connect returns FALSE, probably since there
>> is nothing to connect to.
>>
>> What am I missing? Thank you, TJH
>
> It works for me. It opens the DSN window for you to pick one. Try
> taking
> out your App. References and running it, then reassign the variable
> if it
> works. There must be something funky going on.
>
> HTH,
>
> -seanA
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 08.02.06 23:28 (Wed, 08 Feb 2006 16:28:03 -0600)
From: Sean Arney
> I created a whole new project with 1 window and 1 pushbutton. The
> action event for the pushbutton executes:
>
> DIM SuperAceDB AS ODBCDatabase
> SuperAceDB = NEW ODBCDatabase
> SuperAceDB.DataSource = ""
> IF SuperAceDB.Connect THEN
> MsgBox "we are connected to SuperAce"
> ELSE
> MsgBox "we are not connected"
> END IF
>
> and I still get the "we are not connected" message rather than a DSN
> window. Is there more than one plugin necessary? TJH

No I don't think so because I did exactly as you described and it works for
me and brings up the DSN window. I don't know whats going on for you. OSX
or Win, can you open your DSN admin window normally?

In any case, you could create the DSN normally and then build a connection
string or point to the DSN in the above code and then just open the db using
the GetFolderItem function. I have no clue why that isnt working for you.


-seanA

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 01:28 (Wed, 8 Feb 2006 16:28:27 -0800)
From: TJ Hanson
Sean,

I repeated my test with a program than has 1 window and 1 pushbutton,
with the action event code:

DIM AccessDB AS ODBCDatabase
AccessDB = NEW ODBCDatabase
AccessDB.DataSource = ""
IF (AccessDB.Connect) THEN
MsgBox "we are connected to Access"
ELSE
MsgBox "we are not connected"
END IF

The program has no other code. I still do not get a DSN dialog box,
but I do get "we are not connected". I can execute a GetFolderItem
okay from my program. Is this what you mean by "can you open your DSN
admin window normally?" I also tried loading a string into
AccessDB.DataSource. It behaves like any property defined as a
string. Loading a null string "" does not trigger the DSN dialog box.
Obviously, I am running out of ideas here. TJH



On Feb 8, 2006, at 2:28 PM, Sean Arney wrote:
> can you open your DSN admin window normally?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 03:32 (Wed, 08 Feb 2006 20:32:53 -0600)
From: Sean Arney
> I repeated my test with a program than has 1 window and 1 pushbutton,
> with the action event code:
>
> DIM AccessDB AS ODBCDatabase
> AccessDB = NEW ODBCDatabase
> AccessDB.DataSource = ""
> IF (AccessDB.Connect) THEN
> MsgBox "we are connected to Access"
> ELSE
> MsgBox "we are not connected"
> END IF
>
> The program has no other code. I still do not get a DSN dialog box,
> but I do get "we are not connected". I can execute a GetFolderItem
> okay from my program. Is this what you mean by "can you open your DSN
> admin window normally?" I also tried loading a string into
> AccessDB.DataSource. It behaves like any property defined as a
> string. Loading a null string "" does not trigger the DSN dialog box.
> Obviously, I am running out of ideas here. TJH

I see now you are on Win - this doesn't work on Win on my box either but it
does on Mac. Must be an error in the LR. Use GetFolderItem to locate your
db and fill the DataSource property with the appropriate info:

Dim s As String
Dim ret As String

Prefs.Get(wndPrefs.Pref_gDBDSN, s)
ret = "DSN=" + s
Prefs.Get(wndPrefs.Pref_gUserName , s)
ret = ret + ";UID=" + s
Prefs.Get(wndPrefs.Pref_gDBPassword , s)
ret = ret + ";PWD=" + s
Prefs.Get(wndPrefs.Pref_gServerAddress , s)
ret = ret + ";SERVER=" + s
Prefs.Get(wndPrefs.Pref_gDBName , s)
ret = ret + ";DATABASE=" + s

return ret

Should be something like:

"DSN=myAccessDSNName; UID=userName; PWD= password; SERVER = serverAddress;
DATABASE= dbName"

I have mine stored in a prefs mechanism retrieved as above but you can hard
string these in.

I think all you have to give is the DSN.

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 06:39 (Wed, 8 Feb 2006 21:39:35 -0800)
From: TJ Hanson
Sean,

Looks like that's my only option. I'm running an iMac G5 with OS
10.4.4, so it should work. I'll look at it some more tomorrow, else
it's the GetFolderItem route.

TJH

On Feb 8, 2006, at 6:32 PM, Sean Arney wrote:

>> I repeated my test with a program than has 1 window and 1 pushbutton,
>> with the action event code:
>>
>> DIM AccessDB AS ODBCDatabase
>> AccessDB = NEW ODBCDatabase
>> AccessDB.DataSource = ""
>> IF (AccessDB.Connect) THEN
>> MsgBox "we are connected to Access"
>> ELSE
>> MsgBox "we are not connected"
>> END IF
>>
>> The program has no other code. I still do not get a DSN dialog box,
>> but I do get "we are not connected". I can execute a GetFolderItem
>> okay from my program. Is this what you mean by "can you open your DSN
>> admin window normally?" I also tried loading a string into
>> AccessDB.DataSource. It behaves like any property defined as a
>> string. Loading a null string "" does not trigger the DSN dialog box.
>> Obviously, I am running out of ideas here. TJH
>
> I see now you are on Win - this doesn't work on Win on my box
> either but it
> does on Mac. Must be an error in the LR. Use GetFolderItem to
> locate your
> db and fill the DataSource property with the appropriate info:
>
> Dim s As String
> Dim ret As String
>
> Prefs.Get(wndPrefs.Pref_gDBDSN, s)
> ret = "DSN=" + s
> Prefs.Get(wndPrefs.Pref_gUserName , s)
> ret = ret + ";UID=" + s
> Prefs.Get(wndPrefs.Pref_gDBPassword , s)
> ret = ret + ";PWD=" + s
> Prefs.Get(wndPrefs.Pref_gServerAddress , s)
> ret = ret + ";SERVER=" + s
> Prefs.Get(wndPrefs.Pref_gDBName , s)
> ret = ret + ";DATABASE=" + s
>
> return ret
>
> Should be something like:
>
> "DSN=myAccessDSNName; UID=userName; PWD= password; SERVER =
> serverAddress;
> DATABASE= dbName"
>
> I have mine stored in a prefs mechanism retrieved as above but you
> can hard
> string these in.
>
> I think all you have to give is the DSN.
>
> -seanA
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 16:30 (Thu, 09 Feb 2006 09:30:02 -0600)
From: Sean Arney
> Sean,
>
> Looks like that's my only option. I'm running an iMac G5 with OS
> 10.4.4, so it should work. I'll look at it some more tomorrow, else
> it's the GetFolderItem route.
>
> TJH

You are on a Mac!? I wonder why it doesn't work. I am on a 10.3 box. Ill
try my 10.4 machine later today if I get time. I thought you were on Win
since the db youre after was named AccessDB - if so, youll need a special
driver for Access. Check out ActualTechnologies, I think hteyre the only
Mac to Access driver around and its read only if im not mistaken.

-seanA

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 18:30 (Thu, 9 Feb 2006 09:30:54 -0800)
From: TJ Hanson
Sean,

I need to read the data in a MS Access database. Read only is fine.
Do I understand that the REALbasic plugin for ODBC requires an
additional third party driver? Or is this third party driver in lieu
of the REALbasic driver? TJH



On Feb 9, 2006, at 7:30 AM, Sean Arney wrote:

>> Sean,
>>
>> Looks like that's my only option. I'm running an iMac G5 with OS
>> 10.4.4, so it should work. I'll look at it some more tomorrow, else
>> it's the GetFolderItem route.
>>
>> TJH
>
> You are on a Mac!? I wonder why it doesn't work. I am on a 10.3
> box. Ill
> try my 10.4 machine later today if I get time. I thought you were
> on Win
> since the db youre after was named AccessDB - if so, youll need a
> special
> driver for Access. Check out ActualTechnologies, I think hteyre
> the only
> Mac to Access driver around and its read only if im not mistaken.
>
> -seanA
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: OBDC database question
Date: 09.02.06 23:29 (Thu, 09 Feb 2006 16:29:49 -0600)
From: Sean Arney
> I need to read the data in a MS Access database. Read only is fine.
> Do I understand that the REALbasic plugin for ODBC requires an
> additional third party driver? Or is this third party driver in lieu
> of the REALbasic driver? TJH

The only way I know of to get at an Access db from mac is with the new
driver from Actual Technologies and Ive never tried it. I think they just
released it recently - the RB ODBC Driver definitely will not work from the
Mac. It very reasonable in price, so don't worry too much.

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>