Page 1 of 1
Fetch (write) data from (to) MySql workbench
Posted: Mon Feb 02, 2015 8:39 am
by elias41
Hi,
is there a way to write an EViews program which would enable to fetch from and write to a MySql workbench database?
Re: Fetch (write) data from (to) MySql workbench
Posted: Mon Feb 02, 2015 8:57 am
by EViews Steve
EViews can read from and write to MySQL using their ODBC driver.
You'll have to install the MySQL ODBC driver:
http://dev.mysql.com/downloads/connector/odbc/
Then create an ODBC DSN on your machine:
http://forums.eviews.com/viewtopic.php? ... mysql#p132
Then to read in data:
http://forums.eviews.com/viewtopic.php?f=3&t=28
Or write data:
http://forums.eviews.com/viewtopic.php?f=3&t=29
Steve
Re: Fetch (write) data from (to) MySql workbench
Posted: Mon Feb 02, 2015 8:58 am
by EViews Steve
Re: Fetch (write) data from (to) MySql workbench
Posted: Mon Feb 02, 2015 9:55 am
by elias41
How would the syntax look like between wfopen(type=odbc) and "select ..." in case I would like to connect to a server with a database requiring user id and password?
Re: Fetch (write) data from (to) MySql workbench
Posted: Mon Feb 02, 2015 10:24 am
by EViews Steve
If you save the DSN as a File DSN, you can edit the DSN file (just a simple text file) to store the username and password. This way it's not so easily visible in any command you publish. Here's how to do that:
http://forums.eviews.com/viewtopic.php? ... 300&p=7745
You could also put it into the wfopen command link this:
Code: Select all
wfopen(type=odbc) dsn=MYDSN;uid=USERNAME;pwd=PASSWORD;database=MYDATABASE "select * from tablename" @freq a @id @date(datecol) @smpl @all
The actual labels here (uid, pwd, database, etc.) may be different with different odbc drivers. You'll have to experiment with your ODBC driver to see what works for MySQL.
Steve
Re: Fetch (write) data from (to) MySql workbench
Posted: Tue Feb 03, 2015 4:21 am
by elias41
Many thanks Steve!
Inittially it didn't work cause I used a 32-Bit connection config, after I reinstalled the necessary 64-Bit driver it worked perfectly!
Re: Fetch (write) data from (to) MySql workbench
Posted: Tue Feb 03, 2015 8:37 am
by EViews Steve
No problem.
Yeah I should've mentioned that. 64-bit EViews will require 64-bit ODBC, while 32-bit EViews will require 32-bit ODBC. For some reason, even though the ODBC drivers are technically COM objects, you can't use them cross-bit.