Click to See Complete Forum and Search --> : Linking tables in MySQL?


CWCJimmy
07-20-2006, 05:51 PM
In access you can link a tables from ODBC sources and they work as if they were native tables. Is there a way to do this in MySQL? I can't seem to find anything on it perhaps becuase it's not possible or that I'm using incorrect terminology.

Here's my situation: I'm trying to run queries against an ODBC database and store the results into a MySQL database but the ODBC driver hangs on the type of queries I want to run. So what I'm currently doing is selecting all the records in three tables (each table has 65000 records) via PHP and storing them in a MySQL database and running the queries off of that. The only problem is this is taking a really really long time to run. Just to select the data and then format it for MySQL takes about 4 minutes on the table with the least amount of columns, that's not inserting the data either. I'm trying to get away from this if I can.

Thanks!

aussie girl
07-21-2006, 01:36 AM
The latest version of MySQL lets you create views, they are created by using multiple column names and multiple tablenames...

CREATE view myview AS
SELECT column name, column name, column name
FROM tablename1, tablename2, tablename3
WHERE join = join
AND join = join
AND any other search criteria

Then you can do all your queries on myview

SELECT * FROM myview

Good thing is if the underlying tables of the view are altered or updated or new records inserted myview will be updated with the new info as well, so it's sort of like linking..
http://dev.mysql.com/doc/refman/5.0/en/create-view.html

CWCJimmy
07-21-2006, 09:31 AM
Do you know off the top of your head if these views can be used on external data sources?

Thanks!

chazzy
07-21-2006, 09:44 AM
views really have nothing to do with this issue.

Can you explain what you mean by: "ODBC database" ? how can you have an open database connector database?

CWCJimmy
07-21-2006, 09:54 AM
Sorry,

It's a database based in ProvideX that I use ODBC to connect to.

chazzy
07-21-2006, 10:46 AM
then really it's up to providex to create the database link to your mysql database, has nothing to do w/ mysql at this point if you're attempting to connect to just the odbc source. mysql has no support for db links.

figmentcode
07-21-2006, 11:47 AM
if it's slow, try turning off other web based applications, antivirus, cleansweep, net nanny programs etc. run spyware/adware software to clean up resource hogs.

to check for what ip connections your computer has, in windows, try going to the DOS window (start-run-command) and run the command

netstat

and if there is anything open that there should not be, then you can try and close the app making the connection to free up as much bandwith as you can.

netstat -?
gives you other options for more network output stats

CWCJimmy
07-21-2006, 12:53 PM
Thank you chazzy that's what I was looking to know.

I'll also take a look at what else is running. Thanks Figment.

chazzy
07-21-2006, 04:42 PM
you could use oracle, it has db links :-D