I'm running into a problem while linking some tables and views present on a Oracle 11g database to a Access 2007 file.
I'm using the Oracle Client (SQORA32.DLL) version 11.02.00.03.
If the view/table returns a small amount of data, there's no problem. The problem happens when the view or the table returns a "large" amount of data. I've tried to increase the buffer size on the driver (default is 64000) to see if that happens. I've also removed the "Enable query timeout" option - otherwise I would get a "Query cancelled by user" or a "ODBC - Call Failed" error.
In order to link the tables/views, I've used the "native tool" (External Data -> ODBC Database -> Link to data source by creating a linked table).
I was wondering if I could retrieve the data from the tables/views using vba. Sometimes, I (you should read "I" as "the users") may need to update data on some tables (control tables).
Please let me know your thoughts.
EDIT: Our goal with this project was to migrate from SQL Server 2005 to Oracle 11gR2. After analyzing the behaviour of the Access files regarding the SQL Server, I've concluded that the results are showing like a "cursor" - if you scroll down on the result window, it will load more.
I think that this may be the issue because, AFAIK, Oracle (driver, maybe?) pulls everything from the DB and, only then, populates MS Access.
It's a long time after this so here goes the solution. MS access has a flag for the ODBC connection as "Treat Float as Numeric". This have made the trick.
Related
In MS Access 2010 I am trying to create a linked table to an Oracle table.
When I use the traditional way of doing it via the MS Access menus:
External Data > ODBC Database > Link to the data by creating a linked
table
I cannot see the tables on my Oracle server that I should be able to choose from. The form is empty, even though I know there are many tables at my server.
What is the problem here?
Could it be that the ODBC connection that I'm forced to use is System DSN inside the "ODBC Data Source Administrator" overview under control panel.
NB: The connection is working in other programs, so that is not the problem.
PS: I can off course do it via VBA code instead, which can be done as shown here:
Template code taken from here: https://www.techonthenet.com/access/modules/link_table.php
Here the template code from the link:
DoCmd.TransferDatabase acLink, "ODBC Database", "ODBC;DSN=AAAA;UID=BBBB;PWD=DDDD;SERVER=CCCC", acTable, "schema.table_name", "Access_table_name", False, False
And here the comments from the link:
Please note that you'll need to customize the above line of code, so
that:
AAAA is the name of the ODBC Data Source that you set up. BBBB is the
user name that you will use to log into Oracle. CCCC is the name of
your Oracle server. DDDD is the password that you will use to log into
Oracle. schema.table_name is the table in Oracle that you wish to link
to. For example, "collect.suppliers". Access_table_name is the name
that you'd like Access to assign to the linked table. For example,
"suppliers".
When using the menus, you need to pre-specify a database in the DSN (Dbq parameter in a connection string).
If you don't pre-specify a database, MS Access won't know in which database to look for tables, and it won't do all or all it has access to, so it just does none.
Make sure that the ODBC driver matches your Access version
32 bit Access <--> 32 bit ODBC
64 bit Access <--> 64 bit ODBC
You have some good comments here. If you launch the ODBC panel from the control panel, it will launch the x64 bit version of the ODBC manager. However, most versions of Access are x32 bits.
The most simple way to ensure that your using the correct bit size ODBC manager is to let Access launch the ODBC panel for you. (and it often helps if you right click on your access shortcut and choose run as administrator.
As others noted, when you setup the DSN, do two things:
Make sure during the creating of the connection, you select the database (the default is usually system and that will show a whole bunch of system tables, but none of the ones you want - you want to pick/choose your database. It should appear in the drop down.
The SQL server (not oracle) during the several panels will show this where you choose the database:
VERY important, you also want to check the "save password" box - this ONLY appears during the create of a new DSN - if you miss this, then re-linking will never prompt you for the password - so don't forget this option:
The above panel will show regardless of what ODBC you use - don't forget to check the save password.
Next up:
create a FILE DSN. The reason for this is that Access converts this to automatic to a DSN-less connection for you. That means you can move the database to other machines, or even delete the DSN you created. Access ONLY uses the DSN at link time - after that it not required (however, this advice ONLY applies to a FILE dsn - so that's what you want to create.
I am having some issues connection to an oracle DB using MS Access.
If I use SQL Developer to connect to the Oracle DB I see pretty much every table and view in the DB however when I connect using MS Access I only get a selected few.
I tough it was because the user didn't have Select privileges on the tables I need so I requested the privilege and after a moth of waiting I finally got it but I still cant see the tables on the Access tool.
This is what I see on SQL Developer vs MS access. I need SFMFG.PWUI_CHAR_DEF_EXT to show on access table manager. Any help to solve this mystery is greatly appreciated.
Using Access 2010, if I select External Data ==> ODBC Database ==> Link to the datasource by creating a linked table, I get a windows dialogue of all the available datasources. When I log in to the one I want, I see the names of all the tables I am authorized to select from.
The Linked Table Manager only shows the tables for which there are existing links.
I'm trying to load a table from SQL Server using the Microsoft OLE DB Provider into an Oracle table (using the Oracle Provider for OLE DB). The package is a straight forward OLE DB Source (SQL Server) -> OLE DB Destination (Oracle).
I'm using SQL Server 2008 R2 and Oracle 11g.
Every time I run the package, I get a different number of rows in the destination table, and BIDS reports fewer rows read than there are in the source table. The number of rows returned is different each time I run it. I get no errors or kickouts, but the boxes for the source and destination remain yellow even after BIDS says "Package completed successfully".
Dumping the source table into a flat file instead of the Oracle destination works fine, and I get all the rows that I expect. I can use this flat file to pull the information into the Oracle destination table without problems as well.
Even though I have a work-around, I want to understand why this is happening, and what I can do to resolve this problem without having to use flat files.
Edit: Looks like even using the flat file to Oracle doesn't bring over all the rows. The first time was just luck?
Edit/Update: Running the package out of Integration Services (not BIDS) seems to have eliminated the problem (tested three times). Still don't understand why this is happening though.
After searching here and on the web, I finally decided to post the question. I am running an SQL 2000 server, and linked an Oracle 9i server. Everything works fine when I run queries, and even updates and inserts from and to the Oracle Linked server (using both Microsoft OLE DB driver and Oracle OLE DB driver) using the OPENQUERY approach.
The problem is that, in order to clean code a bit, I want to use four part names in my queries. I am doing this also when querying other SQL linked servers.
But when I run the queries against Oracle using four part names I get this error: ( I am translating the error message from spanish. Probably the original message in english id different)
ERROR: OLE DB 'MSDAORA' returned an invalid column definition.
Error Code: 7318
Digging a bit, I learned that this is probably related to nos having the right collation name set in the linked server properties.
Now... I am not an Oracle expert, so I need to find out what collation is the schema I connect to using in Oracle (apps... yes, I know, I know... )
So, the plain question is... How do I find out what collation Oracle is using? I have access to the Oracle server via Toad... is there any query I can run in order to find this out?
Thanks!
I think you're looking for the NLS settings, which you can find from these views:
V$NLS_PARAMETERS — "Current values"
NLS_DATABASE_PARAMETERS — What the database was created with.
NLS_INSTANCE_PARAMETERS — From changes by ALTER SYSTEM
NLS_SESSION_PARAMETERS — Combined, plus ALTER SESSION
V$PARAMETER — System parameters, where a lot of this is changed (contains all kinds of stuff)
The documentation is rather lacking here (or, quite likely, I couldn't find the right document), but this should get you what you want.
You will probably have to log in as SYSDBA to read some of these views.
I'm working on a legacy application using VB6 and Classic ASP. We're using disconnected ADO recordsets to pass data back and forth. Normally this works. But what has started happening recently is for any inner/outer join, ADO is including these in the available records to choose from. So when were specifying a column to update (in the cases it errors out, the primary key column), it in turns updates the wrong column (with the same name). I know it's normal for ADO to pull the primary keys for any joined tables, but the default for this is for ADO to hide them. In our case ADO isn't hiding them.
What I've narrowed it down to is the SQL Native Client driver is not working correctly. I can go back to the SQL Server driver (SQL 2000) and it works great, but as soon as I switch back to SQL Native Client, it exhibits the behavior above. I've checked the properties on the open connection and the properties of the recordsets themselves, they match in every instance except one (the count of how many hidden columns there are which makes sense, as SQL Native isn't hiding them).
I've tried everything from deleting the MSADC folder from IIS and re-adding it, I've uninstalled SQL Native and reinstalled it (and subsequently upgraded it to the newest version). I've recreated the ODBC connection several times as well in the process of troubleshooting it. At this point I'm at a loss.
Also one thing to add, it appears SQL Native Client works fine on our other servers and no one else is having this issue. Anyone might have an idea of what could be happening? Thanks!
Edit : Example of what's happening (this occurs on for any query (stored procedures if it matters) and with >= 1 joins of any kind)
select temp_id, temp_value on temp_test
inner join another_table on another_table.temp_id = temp_test.temp_id
inner join yet_another_table on yet_another_table.another_id = another_table.another_id
this'll produce in the ado recordset :
SQL Native Client
(0) temp_id
(1) temp_value
(2) temp_id (primary key of another_table)
(3) another_id (primary key of yet another_table)
SQL Server driver
(0) temp_id
(1) temp_value
SQL Server 2005 will show it as it should be as : temp_id, temp_value
this occurs on for any query (stored procedures if it matters)
It's not the issue described here is it? :
If a change in the connection string changes the behavior, I would suppose that you have two different schemas, and then two versions of the same stored procedure; and the one that is executed with SQL Nativ Client is the incorrect one.
I have exactly the same scenario, and have had it for over a year on our servers and servers at our client. I never found a solution and as a result we simply have to use the SQL Server driver, which is a shame as SQL Native seems to connect significantly faster.
It's nothing to do with different schemas or different versions of the same stored proceedure as suggested above. I use a file dsn and simply changing the driver name changes the behaviour to/from that mentioned above. It seems to happen to all views (probably stored proceedures too as indicated)
If anyone does find a solution I'd be keen to hear about it.
Warwick