Solved

To: mrmick

Posted on 1998-05-30
6
194 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

786 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