Solved

To: mrmick

Posted on 1998-05-30
6
192 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now