SCADA reading from MariaDB: Error in Syntax - sql

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.

Related

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.

SQL Server 2014 - Incorrect syntax near the keyword 'tran'

I am trying to install a stored procedures. When I run the query I get Incorrect syntax near the keyword 'tran'
The 'tran' keyword is used in dump tran master with no_log
It would be helpful if anyone help me overcome this issue.
You're getting a syntax error because TRAN isn't a SQL keyword and isn't valid for the syntax of DUMP. See https://technet.microsoft.com/en-us/library/ms187315(v=sql.90).aspx. To use DUMP properly, it's either DUMP DATABASE or DUMP TRANSACTION
Note that per the above link, DUMP is flagged as deprecated and only exists for backwards compatibility. It will go away in the future. You should be using BACKUP (probably BACKUP LOG in this case) instead.
From some SQL Server 2005 documentation on DUMP, I found the following:
The DUMP statement is included for backward compatibility. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, use BACKUP.
I bet that DUMP has already been removed from SQL Server 2014.

Unable to Import a database from Microsoft SQL Server Management Studio to phpmyadmin

Hey folks, the person I am buildling a website for decided to design their own database. They used Microsoft SQL Server Management Studio to build it and such. Now that they are done with the database they exported it to a text file (Tasks -> Generate Scripts). Now when I try to import the file into phpmyadmin I get the following error:
#1064 - 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 '[master] GO /****** Object: Database [Butterbakers] Script Date: 02/15/201' at line 1
The database code is here: http://zamn.pastebin.com/Y3u7MpZ9
phpmyadmin is for MySQL.
Microsoft SQL Server is a different DBMS.
Large parts of the SQL Syntax is DBMS/vendor specific.
The MySQL Workbench has a feature to "Create EER Model from existing Database".
This may be a try but you need a jdbc connection to the MS SQL Server and MySQL...
Converting DDL to a different DBMS is all but easy. And if you're done this doesn't guarantee that an probably already existing application is still working with the other DBMS.
Not switching DBMS and using the free MS SQL Express could be an option.
First decide for a DBMS and restart form zero is surely the cleanest and less painful solution.
With SQL Compare (http://www.red-gate.com/products/sql-development/sql-compare/) and SQL Data Compare (http://www.red-gate.com/products/sql-development/sql-data-compare/) , you can synchronize different DB.

msg102 level 15 error - sql server

I was trying to run a script to create a DB with all the tables and data on a server, which I created using script wizard in SSMS 2008. The destination server is 2005 and since I am unable to just restore a backup, I had to go through this long process which entailed running it through sqlcmd cause it was too large to open in SSMS.
But after running for more than 5 hours, I checked on it and it had the following error:
msg 102 level 15 state 1, incorrect syntax near 'VA'
Now I tried finding the source of the error and looking in the script the only reference to 'VA' are in the data types nvarchar or varchar.
Please help, I really need to deploy this DB.
EDIT
For those who have answered, thanks for the responses. I guess I will have to rerun the script but I would like to know if anyone has any ideas on running the script in SSMS. The script is over 2GB in size since it has to recreate the data and there is no other way to deploy this 2008 DB to a 2005 sql server edition.
Either: you have scripted a SQL Server 2008 only option which can be changed in SSMS (tools..options somewhere)
Or (assuming no other VA strings) the word VARCHAR has truncated to VA. I've had this happen with dynamic SQL: can be a real pain to track down
in SSMS if you double click on the error message in the results pane, it will usually change focus and highlight that line of code. Now, how close that line of code is to the actual error depends on the actual problem, but you should be able to find the line of code it is complaining about.
Really tricky to track these down, but you could either try to generate the script setting the compatibility level for SQL 2005 or use the SQL 2005 tools to generate the script.

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.