Solved

Connecting to oracle under two different uid's

Posted on 1997-06-11
2
254 Views
Last Modified: 2006-11-17
Using ODBC ver2 to connect to an Oracle 7.3 database I get an error if I connect as a second user name, even if it is
a different database object. I can connect to two different
oracle databases without a problem.  I am using VB4 and the
standard database object.  Is there a way to dissconnect the
first session or something.  My code looks something like this:

dim db1 as database, db2 as database, rs as recordset

set db = opendatabase("MyDSn",false,true,"ODBC;uid=user1;pwd=pwd1")
set rs = db.openrecordset(sql,dbopensnapshot,dbsqlpassthrough)
opendatabase("MyDSn",false,true,"ODBC;uid=user2;pwd=pwd2")
set rs = db.openrecordset(sql2,dbopensnapshot,dbsqlpassthrough)

The error happens on the last line. If I reverse the order it is always the latter one that fails.
0
Comment
Question by:edjohn
2 Comments
 
LVL 5

Expert Comment

by:y96andha
ID: 1427127
Try creating another Workspace object, and open the other database in that Workspace.
0
 
LVL 7

Accepted Solution

by:
tward earned 200 total points
ID: 1427128
Maybe you just left it out but you will get an error on the second opendatabase because you are not setting an object equal to it.

Also have you tried looking at Oracle Objects for OLE?  That is what I use here and I have never had any problems with Oracle and Visual Basic.

If you need examples of using Oracle Objects for OLE just let me know as I do have a seperated BAS file that I use to do anything in Oracle.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

16 Experts available now in Live!

Get 1:1 Help Now