X
X. Zhang
I did the following tasks:
1. Created two users, "myUID" and "otherUID", in the same tablespace "T_1"
in the Oracle 9i database. (There are no problems for SQL Server data source
in the same scenario.)
2. Created a ODBC DSN "myDSN" for this Oracle data source (I left User Name
blank). Microsoft ODBC for Oracle V2.575.1022.00
3. Created a bland mdb file (Microsoft Access 2000, 9.0.6926 SP-3) and
created linked tables using ODBC source myDSN. When it prompted for username
and password, I inputed myUID and myPassword, which made those tables linked
to the schema myUID.
4. Run the following code. Strange things happened. Please read the code and
the COMMENTS for details.
'=================================================
Dim strConn As String
Dim DB As Database
Dim dbODBC As Database
'In the current mdb database, I had linked tables from Oracle database
'schema "myUID"
Set DB = CurrentDB()
'++++++++++++++++++++++++++++++++++++++++++++++++++++
'Attempt 1
'I tried to link to Oracle database schema "otherUID"
strConn = "ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;"
Set dbODBC = OpenDatabase("", False, False, strConn)
'The result for the following line was:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
Debug.Print strConn
'But...The result for the following line was:
'ODBC;DSN=MyDSN;UID=myUID;PWD=myPWD;
'It kept the orginal connection to schema "myUID"!!!!
Debug.Print dbODBC.Connect
'++++++++++++++++++++++++++++++++++++++++++++++++++++
'Attempt 2
'I tried to link to Oracle database schema "otherUID"
'I ommited Connect, and let it prompt for username and password
Set dbODBC = OpenDatabase("", dbDriverPrompt, False)
'Here I inputed username and password "otherUID" and "otherPWD"
'The result for the following line is:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
Debug.Print strConn
'Yeahhhh...The result for the following line is:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
'That's what I wanted!!
Debug.Print dbODBC.Connect
'=================================================
What's happened here? Thanks for any hints.
1. Created two users, "myUID" and "otherUID", in the same tablespace "T_1"
in the Oracle 9i database. (There are no problems for SQL Server data source
in the same scenario.)
2. Created a ODBC DSN "myDSN" for this Oracle data source (I left User Name
blank). Microsoft ODBC for Oracle V2.575.1022.00
3. Created a bland mdb file (Microsoft Access 2000, 9.0.6926 SP-3) and
created linked tables using ODBC source myDSN. When it prompted for username
and password, I inputed myUID and myPassword, which made those tables linked
to the schema myUID.
4. Run the following code. Strange things happened. Please read the code and
the COMMENTS for details.
'=================================================
Dim strConn As String
Dim DB As Database
Dim dbODBC As Database
'In the current mdb database, I had linked tables from Oracle database
'schema "myUID"
Set DB = CurrentDB()
'++++++++++++++++++++++++++++++++++++++++++++++++++++
'Attempt 1
'I tried to link to Oracle database schema "otherUID"
strConn = "ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;"
Set dbODBC = OpenDatabase("", False, False, strConn)
'The result for the following line was:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
Debug.Print strConn
'But...The result for the following line was:
'ODBC;DSN=MyDSN;UID=myUID;PWD=myPWD;
'It kept the orginal connection to schema "myUID"!!!!
Debug.Print dbODBC.Connect
'++++++++++++++++++++++++++++++++++++++++++++++++++++
'Attempt 2
'I tried to link to Oracle database schema "otherUID"
'I ommited Connect, and let it prompt for username and password
Set dbODBC = OpenDatabase("", dbDriverPrompt, False)
'Here I inputed username and password "otherUID" and "otherPWD"
'The result for the following line is:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
Debug.Print strConn
'Yeahhhh...The result for the following line is:
'ODBC;DSN=MyDSN;UID=otherUID;PWD=otherPWD;
'That's what I wanted!!
Debug.Print dbODBC.Connect
'=================================================
What's happened here? Thanks for any hints.