• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

To: mrmick

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
teck
Asked:
teck
1 Solution
 
fujicastCommented:
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
 
teckAuthor Commented:
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
 
teckAuthor Commented:
Please give me some time to try out the codes that you have provided. Your kindness is very much appreciated.
Thanks
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
clifABBCommented:
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
 
DalinCommented:
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
 
teckAuthor Commented:
Hi fujicast,
  Thank you for being so helpful and sincere. Thanks
Best wishes,
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now