-1

I managed to connect to MySQL DB via Sql Developer following this guide. MySQL DB shows and I can expolre tables via the navigator. However, I could not run SELECT statement to show any of these tables. In MySQL workbench I used to use :

use [database_name]

Then, run select statement in that database. But in Sql developer, I am not sure what should I add to the statement to make it work. I have tried the following:

select *
from [table_name].[database_name];

It does not work. I found this tutorial, but nothing is mentioned about simple select statement. Any help is deeply appreciated.

4
  • Do you get any errors? Commented Aug 6, 2014 at 11:14
  • Your queries are not MySQL syntax. Commented Aug 6, 2014 at 11:19
  • Shouldn't your query be select * from [database_name].[table_name];? remove the @ symbol Commented Aug 6, 2014 at 11:21
  • If you actually write the [ and ] these must be excluded too. That is SQL server syntax. In MySQL special keywords are escaped with `. Commented Aug 6, 2014 at 11:22

2 Answers 2

2

AFAIK, except MySQL specific commands; all other standard SQL commands like SELECT,INSERT,UPDATE,DELETE should work just fine using SQL Developer. but per your posted query, it looks total strange.

Your query

select * from [table_name]@[database_name];
  1. remove that @ sign.
  2. you should qualify like database_name.table_name.
  3. Unless it's a typo, remove those [] as well from your query statement.

Your query should look like

select * from database_name.table_name;
Sign up to request clarification or add additional context in comments.

1 Comment

This statement works fine when the SQL worksheet is MySQL worksheet. What I need is to write script in SQL developer that combines both DB's (oracle and MySQL). So I Open Oracle DB worksheet in SQL developer and write SELECT statement normal querying oracle DB. But in this worksheet when I write SELECT statement querying MySQL DB, I get "table or view does not exsit". The same statement works fine in MySQL DB worksheet. When I try to add '@' considering that it's remote DB, I get "connection description for remote database not found"! - All above is in SQL Developer
1

You can always write your SQL including database as well, in the form of:

database.tablename

such as:

select * from wordpressdb.usertable where username="someone"

2 Comments

This statement works fine when the SQL worksheet is MySQL worksheet. What I need is to write script in SQL developer that combines both DB's (oracle and MySQL). So I Open Oracle DB worksheet in SQL developer and write SELECT statement normal querying oracle DB. But in this worksheet when I write SELECT statement querying MySQL DB, I get "table or view does not exsit". The same statement works fine in MySQL DB worksheet. When I try to add '@' considering that it's remote DB, I get "connection description for remote database not found"! - All above is in SQL Developer
I think you are mixing up the ideas a bit. When you write an SQL query, it is sent to a server, which responds to it. Hence, you cannot send a query to a server and expect another server to answer it, even partially. What you explain would be possible with cluster systems, but not in mixed environments, ie, you can ask a cluster master of an oracle cloud and get answers derived from other oracle slaves, and same goes with mysql clusters, but as far as I know, a mysql/oracle mixed cluster is not possible. What you need to do is query both servers separately and combine the results in code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.