Solved

To: mrmick

Posted on 1998-05-30
6
195 Views
Last Modified: 2010-05-03
Hi Top expert:
Do you think you can help? I'm trying to disconnect previous oracle session using VB4 before I start a new connection.
 
Scenario:
I have a logon screen which capture user id and password and with the captured values, I will do a ODBC connection to Oracle Unix. Once the connection has been established, I will call a sub routine to check if this user is an authorised user.If negative (ie he is not authorised), then I would expect this ODBC connection to be disconnected and my logon screen to be invoked again to capture new userid and password. Now with these  new values, I will therefore do a connection to Oracle Unix again and check if he or she is authorised and.....

Problems faced
example:when user A logon with his id "kt_wong" (A is not a valid user), oracle connetion establised, sub routine called and found out he is a invalid user. Therefore logon screen will invoke and warning message sound. So if now A key in id "kt_chan" (valid user id) instead of "kt_wong", same thing connection establised and sub rountine called. But this time my sub routine encounter ODBC error cos I have realised my "kt_wong" session has not been disconnected and my sub routine is executing the sql command using kt_chan but yet still within kt_wong oracle session.

Objective:
Therefore I hope to always disconnect any previous session (eg kt_wong) first before I connect a new session (eg kt_chan) using the opendatabase method.

My ways of doing it
Dim db as database,rs as recordset,connect as string
connect="ODBC;DSN=oracle;uid='" & text1.text & "',pwd='" & text2.Text & "';"
set db=opendatabase("",false,false,connect)
I have try using rs.close and db.close but still I could not physically end the previous oracle session. Please help
0
Comment
Question by:teck
6 Comments
 
LVL 1

Accepted Solution

by:
fujicast earned 300 total points
ID: 1462130
Hi,

Hi ! try this way :

Set RS = Nothing ; THis makes recordset object removes from mem
Set DB = nothing ' This makes the database object removes from memory and clear all ODBC connection which it has made.

Hope this help.

Regards,
Fuji

for future consultation please fell free to e-mail me at fujihome@hotmail.com
0
 

Author Comment

by:teck
ID: 1462131
Hi fujicast,
    just to clarify, when you say
Set Rs=Nothing and set db=nothing. Does it mean

Set rs="" and set db="". Is it possible for you to give me a more specfic codes. Sorry for my limited knowledge, Is nothing a keyword and by the way where would be the best to place these two lines of codes. Please advise. Thanks a million.
0
 

Author Comment

by:teck
ID: 1462132
Please give me some time to try out the codes that you have provided. Your kindness is very much appreciated.
Thanks
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

by:clifABB
ID: 1462133
teck:
What fujicast means is exactly what he says:
Set RS = Nothing
Set DB = Nothing

'Nothing' is a keyword in VB that causes the contants of an object variable to be removed from memory.

As an added note, you might want to close the recordset and database first.  You don't *have* to, but it's good programming practice.
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462134
teck,
If you are just look for anwers to a question, address to a special expert is not a good idea. You may not get a answer in a timely manner or not getting a answer at all, because the expert you adrress to may be out of town for some time, or he may not have the expertise on your particular question, or he may not be actively involded in EE at all. Because your question titled "To somebody", other expert may not bother to look at it.
I know mrmick was on trip for sometime and he may (just maybe) not be able to back to EE for a while.
0
 

Author Comment

by:teck
ID: 1462135
Hi fujicast,
  Thank you for being so helpful and sincere. Thanks
Best wishes,
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question