How to resolve the following error in R using ODBC when connecting to SQL Server? - sql

Error in result_fetch(res#ptr, n):
nanodbc/nanodbc.cpp:2966: 07009: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
I have cloned the code for an R dashboard from my company's datahub. When I run it, it has this error when it attempts to pull the data from our database. My partner has the exact same code on his machine and it runs just fine. I have read about similar errors and I only can find that it has to do with a bug in the SQL code. I don't think this can be the case because the code works as is on other machines.

maybe this similar question will help you
R DBI ODBC error: nanodbc/nanodbc.cpp:3110: 07009: [Microsoft][ODBC Driver 13 for SQL Server]Invalid Descriptor Index
If the code works on your coworkers computer, have you compared the EXACT R and Package versions as well as the SQL versions?

Related

SCADA reading from MariaDB: Error in Syntax

We have a SCADA System (Intouch). It had a Access .mdb database file on the client PC, which was defined as System DSN (Windows ODBC).
What I'm trying to do is to migrate the whole DB thing to MariaDB, running on remote server. I have already a running server, the connection from the SCADA PC to the server is up an running and it is added as system DSN in ODBC, using the MariaDB ODBC connector. I was also able to export all the data from Access to the Maria database, using Access's native export to ODBC database, so all my data is in Maria.
The Problem: The SCADA cannot read ot white anythig. In the scada's log i get SQL Syntax errors (forgot to mention, that the scada uses SQL). Thanks in advance!
Update:
It's old fashioned WindowMaker application, not Archestra, thus the SQL Functions are used. I've even changed the ODBC connector from Maria to mySQL
Today I've made some logs. Here the error:
"SELECT Checksum, (rest deletet by me.. is too long).... FROM Stp WHERE ProgNr=1and StpNr=0"
[37000] [MySQL][ODBC 8.0(a) Driver][mysqld-5.5.5-10.3.22-MariaDB]
You have an error in your SQL syntax; check the manual that corresponds
to your MariaDB server version for the right syntax to use near 'StpNr=0' at line 1 (1064)
From the review of your update it looks like its just a plain ol' syntax error.
What you provided:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1and StpNr=0
The logs complain of syntax by StpNr=0 but your problem is immediately before that where you haven't put a space between the AND and the ProgNr=1 command.
Correct syntax would be:
SELECT Checksum, (etc)... FROM Stp WHERE ProgNr=1 and StpNr=0
In my personal experience the WindowMaker SQL functions are extremely clunky to work with (especially with the 131 char limit on message tags). You can usually help yourself out by Logging your Query then trying it directly in your database.

SSAS tabular project connection issue - memSQL DB as data source

I am trying to create a SSAS tabular project where data source is memSQL DB. I am able to connect to the memSQL database from any SQL client tool using MySQL and/or MariaDb OBDC driver. But when I am using the same ODBC driver for a SSAS tabular project "using OLEDB provider for ODBC" then I am getting error like below:
Failed to retrieve data from DATE_DIM. Reason: ERROR [42000] [MySQL][ODBC 5.3(w) Driver][mysqld-5.5.58]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 '*
FROM [DATE_DIM]' at line 1
ERROR [42000] [ma-3.0.9][5.5.58]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 '*
FROM [DATE_DIM]' at line 1
I have used the connect string as "Provider=MSDASQL.1;Persist Security Info=False;DSN=memSQLDB". Test connection was successful, but when trying to preview any table's data it throws the above error to me.
Is it a compatibility issue between memSQL (5.5.58) version and MySQL ODBC driver (version-5.3) or MariaDB OBDC driver (version-3.0.9)?
Can anyone suggest if there is any compatible ODBC driver exists, which can work with SSAS ?
With this error message, it appears it's less about authenticating correctly and more about the SSAS tool issuing queries with syntax MemSQL doesn't understand. Can you grab the query(ies) and post them here? That'll help us migrate these to compatible syntax. Depending on how the tool works, you may not have control over changing these queries, and will need the tool vendor to patch the query syntax to be more compatible.

Error: Invalid column name 'is_memory_optimized' when expand tables in SQL Server

I am encountering an error message when I try to expand or refresh tables in SQL Server. Since I cannot upload images, I will describe below. Could anyone help me?
I am using SQL Server 2014 CTP1
Failed to retrieve data for this request.(Microsoft.SqlServer.Management.Sdk.Sfc)
Additional information:
An exception occurred while executing a Transact-
SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
Invalid column name 'is_memory_optimized'.
Invalid column name 'is_memory_optimized'.(Microsoft SQL Server, Error: 207)
Screenshot:
Image http://tinypic.com/r/6p6iap/8
I just uninstalled the CTP1, and installed the final SQL Server 2014 version. Problem solved. Thanks everyone.

Squirrel SQL Disconnects when Incorrect SQL executed

Squirrel 3.6 connected to Oracle 11g using an Oracle thin driver (ojdbc6.jar).
Whenever I type an SQL query incorrectly, instead of saying 'Wrong SQL' (or something to that effect), I get an Oralce Error (Error: IO Error Size Data Mismatch) and Squirrel disconnects. I then need to reconnect Squirrel which takes quite a while.
Any ideas?
Downloaded the latest OJDBC file and it worked fine.

BRIDGE command in Oracle SQL Developer

Occasionally I need to write queries accessing tables in both an MS Access database and an Oracle database. This can be done in MS Access, but Access limits the SQL I can use and has weird syntax.
The BRIDGE command in SQL Developer sounds perfect for this, but I'm having trouble getting it to work. When trying to execute this:
BRIDGE FallEnrollment2012 AS CentralServer(SELECT * FROM "Fall 2012 Enrollment 10-24-12")
SELECT * FROM FallEnrollment2012 WHERE ROWNUM <=10
I get this error message:
ORA-00900: invalid SQL statement
00900. 00000 - "invalid SQL statement"
*Cause:
*Action:
Between BRIDGE and FallEnrollment2012 a syntax error is indicated, but I can't figure out what the issue is. As far as I can tell from the examples I've looked at, it's correct as written. Can anyone tell me what I'm doing wrong?
This is a bug in SQL Developer 4.0 Beta1 & Beta2.
The workaround is to start SQL Developer , Tools > Migration > Scratch Editor .Then open the worksheet and run your BRIDGE command.
In this way the migration plugin is loaded which provides the BRIDGE functionality.
A fix is being worked on
Regards,
Dermot.