Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
I am in a setup with a Microsoft SQL Server on one side and trying to SELECT and UPDATE / INSERT data based on different databases on this server.
With the tDBConnection I can specifiy the Database but it seems like it is not considering that specification:
But how do I prevent 1.?
I am getting errors when trying to specify the table for the update / insert-action via [db_name].[dbo].[tablename]. " > INVALID OBJECT NAME
Any suggestions why the database-context for the connection is not working and how to specify the correct database for both querys to DBInput and DBOutput?
I am using Talend Open Studio 7.1 at the moment.
Finally I got the reason: I was working with a subjob and forgot the small checkbox: "transmit whole context". Aaargh.
Hi
You can't select data from different database on the same tDBInput componnent (only one connection established), as a workaround, use two tDBInput components to query data from different Database, and then do join on tMap.
Regards
Shong
Hi,
I would suggest you create two tDBConnection components, one as the source/select connection and one as the desination/insert connection. That would probably just good practice, but also will help you, in this case, isolate the problem.
Also, remember that in database select statements, you should fully qualify the table name:
SELECT col1, col2,col3
FROM {database}.{schema}.{table}
Thanks
David
Thanks for your feedback, @Shicong Hong and @David Beaty .
There is a misunderstanding though: i do not want to select from two different databases but only from one. And the select is not a problem since I use the statement "USE [db_name] SELECT * FROM [table]" now altough the db_name is already specified in the connection.
BUT there is no option to have "USE *" on tdboutput so it is inserting my values in the wrong database now [e.g. db_name_2] - even if the connection is still on [db_name].
Any suggestions?
Hi, is your tdbOutput is relied to the good tDbConnection ? Maybe you'll have to delete the component and recreate a new one relied to your tDbConnection component. Could you send screenshots of your job?
I am providing a screenshot (in german). You see the connection open the db is used to do the update later on. But the table I specify in tDBConnection_1 is not updated through the tDBOutput_2 but rather a different table.
ok, is your tDBconnection_1 is correctly set, are you using shared db on your tDBConnection_1 ?
cause shared Db can overwrite settings of a tDBConnection.
"But the table I specify in tDBConnection_1 " :
you can only specify db on TdbConnection not tables, and in tDBOutput you can specify the table on table field, the db is automaticly recognized by the tDBConnection link.
Hey @guenneguez jeremy , thanks for all your valuable feedback!
Yes, the setup is a shared db.
I am confused, since the DBConnections lets me specify a database as well .. at least this is what I thought it would do ?!