ERROR [3D000] [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.9]No database selected

I’ve got WampServer running a local instance of WordPress, and I have SSRS running in native mode.

I’ve written a report that queries the MySQL database, and it works and runs just fine within Visual Studio.

Read More

If I launch it though, it first had issues with my ODBC shared data source, which was as follows:

Name of shared data source: localhost.rds  
ODBC Connection string: Dsn=localhostuserDSN

That DSN is a user DSN (as you might’ve guessed), and it uses the MySQL ODBC 5.3 Unicode driver. It’s configured as follows:

TCP/IP server: localhost
Port: 3306
User: root
Password: <blank>
Database: wp

When tested, the connection succeeds, and the report works just fine.

When deployed though, I got the following error:

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

After much research and hair-pulling, I finally found out that if I changed the data source connection string to…

Dsn=localhostUserDSN;Driver=MySQL ODBC 5.3 Unicode Driver

…that also works, and at least then, the connection also succeed when in the Data Sources configuration screen for the report after it’s deployed. But then, just when I thought I was finally out of the woods, I run the report and get the following error message:

ERROR [3D000] [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.9]No database selected

The thing is, I can’t specify a database, or at least I don’t know a way to.

If I try changing the connection string to…

Dsn=localhostUserDSN;Driver=MySQL ODBC 5.3 Unicode Driver;database=wp

…it says the (blank) password isn’t valid, before I’ve even pressed the ‘Test’ button.

If I tack on ‘USE [wp]’ to the query in Visual Studio, it abruptly protests.

I thought maybe I’d get around that by putting it in a stored procedure, but since the data is being queried directly from the MySQL database, I can’t do that either.

(Before attempting any of this, I already tried syncing/converting the MySQL db to the SQL db, but I kept running into issues with the data conversion.)

Thinking it might be a permission issue, I’ve also tried running…

GRANT ALL ON [wp] TO root@localhost;

…and…

GRANT ALL PRIVILEGES ON [wp] TO root@localhost;

in SSMS, but in both cases, it says:

Cannot find the object 'wp', because it does not exist or you do not have permission.

And I’m the only admin on a local machine. I installed SQL and it uses Windows Authentication, so I don’t see how I wouldn’t have permission, and I have to assume it’s an issue with the syntax.

I saw elsewhere here that someone suggested ‘[wp].*’, but it doesn’t like that either.

I’ve been at this literally all day, and I’m at my whits end, so any constructive feedback would be greatly appreciated!

Related posts

1 comment

  1. For anyone stumbling across this in the future, I think we resolved the original issue, although I’ve run into other issues which may be specific to me.

    Three things, not sure if the first one is related:

    1) In the query for the dataset of the report, I specified the table like so "SELECT wp_posts.ID FROM wp_posts" instead of just "SELECT ID FROM wp_posts".

    2) I went back to adding on “database=wp” to the ODBC connection string.

    3) Even though both work in Visual Studio, I switched to a System DSN instead of the User DSN.

    I think that should get you back in action.

Comments are closed.