Dynamic SQL error in Talend - sql

I'm learning Talend. I'm trying to connect to a DB and just pull tables from it.
I've managed to create the connection metadata and was able to connect to the SQL Server DB.
However, when I drag&drop the connection into the job (as a tsMSSqlInput) and run the job, I get the following error :
Exception in component tMSSqlInput_1
[FATAL]: talend_train.engia_test_0_1.ENGIA_Test - tMSSqlInput_1 An object or
column name is missing or empty. For SELECT INTO statements, verify each
column has a name. For other statements, look for empty alias names. Aliases
defined as "" or [] are not allowed. Change the alias to a valid name.
java.sql.SQLException: An object or column name is missing or empty. For
SELECT INTO statements, verify each column has a name. For other statements,
look for empty alias names. Aliases defined as "" or [] are not allowed.
Change the alias to a valid name.
My guess is something wrong with the dynamic query (using context variables) :
"SELECT \""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_UN,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_TN,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_PK,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_SK,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_FN,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_OV,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_NV,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_ID,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.AU_TA_DT,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.SY_FI_DA,
\""+context.Engica_Connect_Schema+"\".CM_AU_TA.SQL_TIMESTAMP"
+"
FROM \""+context.Engica_Connect_Schema+"\".CM_AU_TA"
Something must be wrong with the double quotes, I'm not sure where or how.
Also, when I try to run the query to get a preview heres what I got :
Incorrect Syntax error
Any ideas please ?

Related

SQLite [SQLITE_ERROR] SQL error or missing database (near "',pass='": syntax error)

in the camp I am at we were given an assignments to try to do some basic SQL injection.
There is a table named info with a few fields. There is a field named id, a field named sum and a field named pass.
What I am trying to do is given some id change both the sum and the pass matching that id.
What I was trying to do is:
http://a/b/c/withdraw?id=123456789&sum=7312',pass='weak
But I am getting this error:
[SQLITE_ERROR] SQL error or missing database (near "',pass='": syntax error)
When I do this:
http://a/b/c/withdraw?id=123456789&sum=7312
The sum field changes successfully, but I need to change the password matching the id as well.
Can anyone here tell me what's the problem?

Correct VBA Syntax for DB2 Command?

I'm attempting to connect to DB2 through VBA. I have a connection established through the ODBC provider.
Here's the string of my command text looks like:
strCmd = "INSERT INTO mySchema.myTable (Text) VALUES ('Test')"
When I run this, I get the following runtime error:
[IBM][CLI Driver][DB2/NT64] SQL0204N "MYSCHEMA.MYTABLE" is an undefined name. SQLSTATE=42704
I have validated and verified that the schema and table exist in DB2. I have validated (by using another tool - IBM Data Studio - that the credentials have access and authority to write to this table.
Is my syntax wrong? Is there something I'm missing? If I don't add the "MYSCHEMA." in front of the table name, it presumes I want the "ADMIN" schema, which I don't (it doesn't even exist).
How do I successfully execute an insert command to DB2 LUW?
This is frequently asked.
Db2 automatically folds unquoted object names into uppercase.
This makes programming easier because being forced to quote objects is not so friendly.
It means that "myTable"."mySchema" is a different object than MYTABLE.MYSCHEMA.
So in general it is easier to configure your toolset to not quote object names when creating the objects, and so allow them to be folded to uppercase. It also allows subsequent queries to avoid having to quote table names and column names.
But sometimes you don't have a choice.

Facing an error when trying to insert the data in database using db2?

I'm trying to insert a row in the table by using below code but it is throwing an error. can anyone help me out to solve the error?
Thanks in advance!!
db2 "Insert into TARIFF_PRODUCT_ATTRIBUTES values (409499, 'ADDITION_SMS_TEMPLATE', 'IDSSMS1')";
Error is :
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0204N "DB2EAI2.TARIFF_PRODUCT_ATTRIBUTES" is an undefined name.
SQLSTATE=42704
Common causes of SQL0204N in Db2:
spelling mistake in the object name
object does not exist in the currently connected Db2 database
object exists in current database but in a different schema than your current default schema (so you must qualify the name with the correct schema-name).
mixed case table name (Db2 will always uppercase unquoted object names, so if the object is Tariff_Product_Attributes then use double-quotes around the name in the SQL to allow Db2 to find the object).
There are other less common causes , see the documentation for the complete list.

Unable To Run Access Report With Column Name Which Has Special Character

I'm trying to run a report in Access that references a poorly named column: Vendor#. For those of you not familiar with Access: '#' is a reserved keyword with special meaning. I've been trying to run the report and every time I do a popup appears asking for a value for the column: in other words it keeps seeing it as a variable name. I've tried a number of variations on the name including: [Vendor#], 'Vendor#', ['Vendor#']. I tried an Alias but then I encountered the same issue in the where clause referencing the Alias. No I can't change the schema to rename the column to something more appropriate. Any help is appreciated.
Here is the query:
SELECT * FROM dbo_Vendors
WHERE ((dbo_Vendors.[Vendor#]) = [Forms]![frm_Report_Vendor]![VendorNumber])
I have just tested with a linked sql server table having a column called Vendor#. I can create a report and it runs correctly.
Can you save the query and test that the query runs? I suspect that you may have a misspelled form reference, because I have tested the whole scenario and it works for me. I do not think the report has anything to do with it.

sql server 2005 express - Invalid Object Name error

I have a copy of a query from a view (by filtering) and when i tried to excute it, it throws an error message that says "invalid object name 'bla bla'".
How can i fix it?
I am using windows 7(ultimate) os and sql server 2005 express.
You may be executing the query in the wrong database. If you are running it manually in SSMS, use the 'use' statement or the 'available databases' drop down list to select the correct db.
Or fully qualify the name of the object you are accessing (db_name.owner.object_name).
Or, as rlb.usa suggests, maybe the object just doesn't exist. (check your spelling...)
It can happen two ways:
You have table, procedure, or function name(s) that do not exist.
You can fix this by verifying the object does indeed exist. Check this one first. Is the spelling correct? Is the schema correct? (dbo.mytable != user.mytable)
SQL wants you to use "qualified" names.
You can fix this by putting use mydatabasename; at the top of your query, before the query itself. If it doesn't like that one, you can then try the longer method of using qualified names by prefixing all of your tables, functions, and procedures as databasename.schema.object .