By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,899 Members | 1,085 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,899 IT Pros & Developers. It's quick & easy.

Connect 2 databases with different ports number in 1 sql statements

P: 2
Hi,
I need to create a sql select statement which join 2 databases, where both the database have to connect with different port numbers,
db1 port: 3306
db2 port: 3311
select something from db1.table1 A left join db2.table2 B on A.id = B.id

when i execute it, the error msg come out:
SELECT command denied to user 'username'@'localhost' for table 'table1'

I need to solve it urgently, all helps will be appreciated

Thanks in advanced.

Yii Ing
Jan 13 '07 #1
Share this Question
Share on Google+
5 Replies


ronverdonk
Expert 2.5K+
P: 4,258
Hi,
I need to create a sql select statement which join 2 databases, where both the database have to connect with different port numbers,
db1 port: 3306
db2 port: 3311
select something from db1.table1 A left join db2.table2 B on A.id = B.id

when i execute it, the error msg come out:
SELECT command denied to user 'username'@'localhost' for table 'table1'

I need to solve it urgently, all helps will be appreciated

Thanks in advanced.

Yii Ing
You can SELECT different tables but the tables must exist within ONE logical database, not from two or more logical databases.

Ronald :cool:
Jan 17 '07 #2

P: 3
Why don't you create new table in the same database it much better, than you have two database with different port.
Jan 18 '07 #3

ronverdonk
Expert 2.5K+
P: 4,258
You could use a temporary table. Then you

- connect to 1st database
- read the table from the 1st database into storage
- connect to the 2nd db and create a temp table
- store the data from the 1st db into the temp table
- perform your query

Ronald :cool:
Jan 18 '07 #4

P: 2
Thanks to all, i already found the solution, juz to grant access between the two database will solve my problems.

Thanks.

Yii Ing
Apr 30 '07 #5

P: 2
one server with two different database
hai...

i have problems to connect the jboss server with two different database which is Oracle and Mysql.

this two db have same db name example Student. if one of the db corrupt the server can connect to another one.example oracle to mysql or mysql to oracle.

can one server connect different database.each database can share same domain example 10.2.2.56...

please help me...i really stuck.

me,
ezly
Dec 27 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.