Pentaho "Couldn't get row from result set" error - mysql

When I run this query on my MySql client (DBVisualizer) it runs. (It functions and works 100%)
SELECT
MAX(birth_date) AS max_bd
INTO
#bd_max
FROM
employees.birthdays
WHERE
gender= 'male';
When I run it in Pentaho, in a "Execute SQL script" I get this error
2018/11/04 10:44:08 - job_update_birthdays - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : An error occurred executing this job entry :
2018/11/04 10:44:08 - job_update_birthdays - Couldn't get row from result set
2018/11/04 10:44:08 - job_update_birthdays - ResultSet is from UPDATE. No Data.
P.S. I am using the same credentials for both Pentaho and my Mysql client.

You're using a command that doesn't acutally returns data. In SQL, the INTO command will copy the data from the SELECT, INTO another table, what SQL is doing is probably just showing you the data that was copied to the target table.
Remove the INTO #bd_max clause from the query and run it.

Related

"[Amazon][ODBC] (11310) SQL C type not supported." Error while using "Execute SQL Task" with Single Row ResultSet through Redshift

I have created a Execute SQL Task to query Redshift and save the Single Row resultset to a variable using SSIS. I am using ODBC connection and query is as simple as:
select 1 as id
I have set the ResultSet properties to Single row and assigned the Result Name=1 to a variable.
When I execute the task with setting the Resultset=None it works with no error but when I execute it with Resultset=Single row I see this error:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "variable_name": "[Amazon][ODBC] (11310) SQL C type not supported.".
Found the solution!
I changed Connection Type = ADO.NET and used .Net Providers\Odbc Data Provider instead of ODBC Connectin and it works perfectly.

Error in mysql database in Qt

I wrote this sql codes in qt5 in ubuntu. I want to update a table. But I received following error:
QSqlError(1065, "QMYSQL: Unable to execute query", "Query was empty")
This is my sql code:
query4.prepare("update food_main set cost=:material_cost,"+material+"=:material_num where name='"+material_name+"'");
query4.bindValue(":material_cost",material_cost);
query4.bindValue(":material_num",material__num);
query4.exec();
I must say that my table updates every time I run my code but I have the error too. Table and columns and variables were made in right method. What should I do?

Sql Server sp_send_dbmail linked mysql server error

execute msdb.dbo.sp_send_dbmail
etc etc
#query = 'select * from Mysql...MemberRef4 as oi where oi.MemberId = 133363 '
The above is a query that I plugged into an existing working send mail method. MySql is a linked MySql database. I CAN run this query without any errors, correctly, by selecting the query code and F5. I am running this code and other MySql code joins with SqlServer and other linked servers - without any errors, including views/procs/etc.
However, the sp_send_dbmail method fails with :
Msg 22050, Level 16, State 1, Line 0
Failed to initialize sqlcmd library with error number -2147467259.
Note: this is the first time I'm trying to put MySql queries in sp_send_dbmail
Any help please. I really don't want stored procs that create temp tables/etc :(

SSIS Execute SQL Task SQL Command Issue

I have the following insert statement in my execute sql task in SSIS:
INSERT INTO dbo.SSISLogTest
(NodeID, BusinessDate, StartDate, StopDate, StepName, RecordCount, Message, Status, UserID)
VALUES (?,?,?,?,?,?,?,?,?)
When I run it within the task providing parameters it executes fine and inserts a record in the table.
When I run the package, this step fails with the following error:
"[Execute SQL Task] Error: Executing the query "INSERT INTO
dbo.SSISLogTest
..." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the
query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly. "
Different connection providers require different syntax - all of the following must be set correctly:
The connection type (i.e. OLE DB, ADO...) Your choice, but aim to use the same throughout your application.
The number and specifics (Variable Name, Direction, Data Type, Parameter Name, Parameter Size) of parameters on the "Parameter Mapping" dialog.
The parameter syntax in the SQL query (i.e. your question marks.)
Please see an OLEDB example in the screenshots below and refer to Working with Parameters and Return Codes in the Execute SQL Task for details.

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)"

ERROR MSG: The requested operation could not be performed because OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" does not support the required transaction interface.
I am stucked finding solutions for this error (see ERROR MSG).
Here is part of my code:
.....
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;
Database=C:\Folder\file_output.xls',
'SELECT * FROM [Sheet1$]')
SELECT FROM FIELD1, FIELD2, FIELD3 dbo.MY_TABLE
WHERE TRANS_ID = 1
ORDER BY CTRL_NO ASC
.....
The above code is contained inside an SP... This is the last SP that is run in a series of SP calls.
Here is the chain/flow of execution: SP1->SP2->SP3->SP4 (assuming SP4 contains the above code)
But an error occurs as what the ERROR MSG suggests during the entire execution flow.
Here are the 2 scenarios that I've tried to test/trace the error.
- Run the the chain of SPs ----> result: error occurs
- Comment/Remove SP4, then run SP1->SP2->SP3 only. Then separately execute SP4. ----> result: okay
PLS. NOTE:I need to execute the SPs in flow.
There is no web/any front-end except SP1 is executed through SQL runner
I now wonder if this is a bug in MS SQL Server 2008 or I'm missing something.
If my question is still vague, kindly ask me for clarification. Thanks.
Try to check "Non transacted updates" option in "Server objects - Linked servers - Providers - Microsoft.Jet.OLEDB.4.0" properties. Maybe you will need to restart your sql server.