How do I access an MS Access database from Oracle? - sql

Configured access from Oracle to MS Access.
Oracle XE 11.2.0.2.
Microsoft Access 2010
There are two INSERTS (insert into table that is residing in MS ACCESS db) operations. One of them is using pl\sql variables, another one is not.
First insert:
insert into SomeTable#MSADB("ID", "Name")
values(l_ID, l_Name);
Second one:
insert into SomeTable#MSADB("ID", "Name")
values(123, 'SomeName');
In a case of second insert, all is fine. But first one gives an error "HYC00 NativeError=106 optional feature not implemented". I just can't understand why this is happening and how to solve this problem.
Bind variables(execute immediate) didn't solve this problem. DBMS_HS_PASSTHROUGH.BIND_VARIABLE didn't solve this problem either.
Only solution I see is embedding those variables into a string and then execute it.
Are there another solutions to force the first insert to work?
Thank you.

There was a known issue in the Oracle 11g client with the ODBC driver connecting to excel workbooks and it was giving the same error. Oracle released Patch 7009291 to address that issue so you might take a look at that patch to see if it will address the access issue as well.
You can also enable DG4ODBC tracing to see what is going on and identify if this is a similar issue to the excel one. Tracing is enabled by setting in your init.ora file HS_FDS_TRACE_LEBVEL=255 The trace file is then found in your \hs\trace

Related

HSQLDB:user lacks previlige or object not found

I created a table in HSQLDB, but when I insert any value into the table I am getting the following error:
user lacks previlige or object not found.
My column names are username and password. This is HSQL Database Engine In-Memory. The driver is org.hsqldb.jdbcDriver and the url is jdbc:hsqldb:mem. What did I do wrong, can anyone help me out?
You are almost certainly creating the table in one Java process and inserting the values in another Java process.
The short answer is: use an HSQLDB server for the database and connect to the server from your different processes.
See the Guide on how to run a server.
http://hsqldb.org/doc/2.0/guide/listeners-chapt.html#lsc_hsql_server
There are also HowTo pages at http://hsqldb.org

copying data between servers on two different machines - SQL

I found this question Copy table to a different database on a different SQL Server which is close to what I want but my two databases are on two different machines. I am interested in backing 1 or two tables, not the whole database. I tried BCP backup and bulk insert but I am consistently getting error on importing date field (type mismatch or invalid character for the specified codepage). I gave up after I successfully imported the peice of csv file that I was getting error for in a new test table.
Now I would like something like this
select INTO mycomputer\SQLEXPRESS\target_table from ReMOTECOMPUTER\SQLEXPRESS\source_table
or anything similar? Can I do that, what is the proper syntax if yes. I tried but was not successful.
Have you looked at using linked servers? We had a somewhat similar data consistency issue and used a linked server setup to provide for triggered data propagation. Once you have the linked servers defined you can issue your statement pretty much as you have it listed in your question.
http://msdn.microsoft.com/en-us/library/ms188279.aspx

How do i get the names of all the tables inside a database?

EDIT2: Found a fix! I used the number of the desired schema instead of the name. Should've thought of that before, really! And i think the error messages could've been a bit better aswell. Thanks for all your time!
How can i get the names of all tables inside a database through sql inside asp classic?
The server is running windows 2008, iis7.5 and microsoft jet. I've tried all the querys i could find on the internet (and here) but none have worked.
If i add a ; to the query to run a set of querys at the same time it gives me an error because the statement isn't over at the semicolon.
The master.mdf database cannot be accessed because it's of unknown format.
The sysobjects variable apparently doesn't exist.
I am using mssql 2000 format. (.mdf)
The connection is made through classic asp with the Microsoft.Jet.OLEDB.4.0 provider and ADODB connection/recordset.
How do I get list of all tables in a database using TSQL?
Query to get the names of all tables in SQL Server 2008 Database
EDIT:
I've found two folders containing databases. One is in C:\program files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\mssql\binn\templates and contains master.mdf, mastlog.ldf, model.mdf, modellog.ldf, msdbdata.mdf and msdblog.ldf. The other one is also in the \binn\template data directory and contains master.mdf, mastlog.ldf, model.mdf, modellog.ldf, MSDBData.mdf, MSDBLog.ldf, mssqlsystemresource.ldf, mssqlsystemresource.mdf, tempdb.mdf and templog.ldf. Maybe these is of some interest?
How can i tell if i have permission? Does it give a permission denied error?
Please help! No, don't. Read the 2nd edit at the top.
USE YOUR_DATABASE
GO
SELECT *
FROM sys.Tables
GO
Have you tried the example from:
http://www.kamath.com/codelibrary/cl002_listtables.asp
I almost always use the INFORMATION_SCHEMA views:
SELECT * FROM INFORMATION_SCHEMA.TABLES
If this isn't working for you, the SQL user your site is running under may not have access to the system objects. This is actually a good thing, as giving your site access to the underlying database schema can leave you vulnerable to SQL injection.
So if you do go this route, proceed with caution.
The mdf by itself is useless: you need a database engine (a.k.a. a SQL Server instance) to "run" it. As I understand the question, this is your problem.
Then you can use sysobjects in your database: unless you have added your tables to the master database
There is no practical way to use an mdf directly: if nothing else download MSDE

How do I use SQL to Drop a Column from a MS ACCESS Database if that column is a replication ID?

I had a notion to use a database column of type replication ID, but have since changed my approach and want to use this column for another purpose.
However, I'm unable to use SQL to drop the column to remove it from my database.
My SQL is:
ALTER TABLE foo_bar DROP COLUMN theFoo;
However, I get a "syntax error" and I'm assuming this has something to do with this column being a replication ID.
I'd rather not download the file and edit it directly using the MS Access application, but not sure if that's my only recourse.
Thanks so much in advance.
Regards,
Kris
If you have access to the database in a command shell, Michael Kaplan's Replication System Removal Fields utility should do the trick. However, I've found that in some circumstances, it's unable to do the job. Also note that the utility will only work with a Jet 4 format database (MDB), not ACE format (ACCDB).
If all else fails, you can recreate the table structure and append the existing data to it. That can get messy if you have referential integrity defined, though, but it will get the job done, and likely most of it is scriptable (if not all possible using just DDL).
Here is a link that may help you, I had a similar idea but when browsing the web found this
AccessMonster - Replication-ID-Field-size
EDIT: Well I don't have much time but what I was thinking of first was if you could alter the column to make it different (not a replication ID) and then drop it. (two separate actions). But I have not tested this.

SSIS and MySQL - Table Name Delimiter Issue

I am trying to insert rows into a MySQL database from an Access database using SQL Server 2008 SSIS.
TITLE: Microsoft SQL Server Management Studio
------------------------------
ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.51a-community-nt]You have
an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '"orders"' at line 1
The problem is with the delimiters. I am using the 5.1 ODBC driver, and I can connect to MySql and select a table from the ADO.Net destination data source.
The MySql tables all show up delimited with double-quotes in the SSIS package editor:
"shipto addresses"
Removing the double quotes from the "Use a table or view" text box on the ADO.NET Destination Editor or replacing them with something else does not work if there is a space in the table name.
When SSIS puts the Insert query together, it retains the double quotes and adds single quotes.
The error above is shown when I click on "Preview" in the editor, and a similar error is thrown when I run the package (albeit then from the actual insert statement).
I don't seem to have control over this behavior. Any suggestions? Other package types where I can hand-code the SQL don't have this problem.
Sorry InnerJoin, I had to take the accepted answer away from you. I found a workaround here:
The solution is to reuse the connection for all tasks, and to turn ANSI quotes on for the connection before you do any inserts, with an Execute Sql task that runs the following:
set sql_mode='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,
NO_ENGINE_SUBSTITUTION,ANSI_QUOTES'
Try using square brackets around the table names. That may help.
EDIT: If you can, I would create views (with no spaces) based on the Access tables, and use those to export. Even if it means building another Access database with linked tables, I think this is your best bet.
I've always struggled with using SSIS with MYSQL directly. Even after installing the ODBC drivers, they just don't play well in data flows. I've always ended up creating linked ODBC connections between SQL Server and MYSQL. I then rely on linked server queries to bring over data. Instead of using a SSIS data flow task, I use an Execute SQL command, usually in the form of a stored procedure that executes an OPENQUERY.
One solution you could do is load the data into a SQL Server database and use it as a staging environment before you load it into the MYSQL database. I regularly move data between SQL Server 2008 and MYSQL and in the past I use to regularly move data between Access and SQL Server.
Another possible solution is to transform the incoming Access data before it loads into the MYSQL database. That may give you a chance to clean up the column names and the actual data that's going through to MYSQL.
Let me know if either of these work for you.
You can locate the configuration setting file my.ini at <<Drive>>:\ProgramData\MySQL\MySQL Server 5.6\my.ini and add "ANSI_QUOTES" to sql-mode.
e.g: sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES". This should solve the issue while previewing in the SSIS editor.