Re: how to reconnect to Oracle from VB 4 app

From: Larry Tubbs <ltubbs_at_flash.net>
Date: 1996/12/19
Message-ID: <01bbedc4$15182f20$43c0b5cf_at_enigma.flash.net>#1/1


Hello Geoff,

You are so close, but you are also so far. Try setting a global variable of type Database via your OpenDatabase method:

	' In the declaration section of a module
	Dim db as Database

	' in your code at the point where you want to reconnect to oracle
	Set db = Nothing
	Set db = MyWorkspace.OpenDatabase("", False, False, "ODBC;")

Then, anywhere in your code that you need to access the database, you do it through the db global variable:

        db.OpenRecordset("SELECT * FROM tblFred;")

For example. I hope that helps you.

Larry Tubbs, MCPS, MCSD
Silverleaf Vacation Club
mailto:ltubbs_at_flash.net
http://www.flash.net/~enigma/

Geoff Ingram <lsgvi02_at_chsrh1.agw.bt.co.uk> wrote in article <32B94A8F.371E_at_chsrh1.agw.bt.co.uk>...
> Running VB 4 on Windows NT 3.5.
>
> I want to connect to a particular Oracle account within my VB app, and
> later close this connection, then reconnect to a different Oracle
> account.
>
> I can connect to Oracle using:
>
> MyWorkspace.OpenDatabase("", False, False, "ODBC;")
>
> this works fine. To reconnect, I call OpenDatabase again and specify a
> different account/password in the dialog.
>
> The connection to the new user *does* take place (shown by auditing
> connections) but immediately disconnects, leaving the app still
> connected to the first session.
>
> What do I need to do to close the first connection, and keep the second.
>
> I tried:
>
> set DBEngine = Nothing before the OpenDatabase. I tried Workspace.Close
> before the OpenDatabase. Neither made a difference. (The docs say that
> Close on the default Workspace(0) that I am using is ignored).
>
> regards
> Geoff Ingram
>
Received on Thu Dec 19 1996 - 00:00:00 CET

Original text of this message