"No database selected" Error
"No database selected" Error
"No database selected" Error
"No database selected" Error
"No database selected" Error
"No database selected" Error "No database selected" Error "No database selected" Error "No database selected" Error "No database selected" Error "No database selected" Error "No database selected" Error "No database selected" Error
"No database selected" Error "No database selected" Error
"No database selected" Error
Go Back  Xtreme Visual Basic Talk > > > "No database selected" Error


Reply
 
Thread Tools Display Modes
  #1  
Old 05-02-2008, 08:27 AM
AstroTux's Avatar
AstroTux AstroTux is offline
Junior Contributor
 
Join Date: Aug 2007
Posts: 345
Default "No database selected" Error


Hi,

When I put my ASP.NET app onto my server (IIS5.0/.NET 2.0), I get the following error:

Code:
ERROR [3D000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.37-community-nt]No database selected]
At this line:

Code:
Dim dbReader As OdbcDataReader = dbQuery.ExecuteReader
The complete block of code reads:

Code:
Imports System
Imports System.Data
Imports System.Data.Odbc

'...

        Dim dbCS As String = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=<IPADDRESS>; DATABASE=<DBNAME>; UID=<USERID>; PASSWORD=<PASSWORD>; OPTION=3" 'PORT=3306" OPTION=3"
        'Dim dbCS As String = "DSN=<DSN>;PORT=3306" 'OPTION=3"
        Dim dbConn As New OdbcConnection(dbCS)

        dbConn.Open()

        Dim dbQuery As OdbcCommand = dbConn.CreateCommand()

        Dim DBPass, DBAdmin As String

        dbQuery.CommandText = "SELECT password, admin FROM users WHERE username='" & LCase(txtUser.Text) & "'"
        Dim dbReader As OdbcDataReader = dbQuery.ExecuteReader
        ' ...
If I run the pages on my dev machine and access the database server via the LAN, it works fine, but when the ASP pages are put onto the server, it errors.

I've created both User and System DSNs in the ODBC connection manager on both the local machine and the server, but that doesn't seem to fix it, either. I can't seem to find a resolution to this problem.

It's not an immediate problem as it works on my dev machine so I can get the project completed, but it will be a problem when I need to deploy it.

Best regards,
AstroTux.
Reply With Quote
  #2  
Old 05-02-2008, 05:57 PM
AstroTux's Avatar
AstroTux AstroTux is offline
Junior Contributor
 
Join Date: Aug 2007
Posts: 345
Default

No one???

It seems that no-one, anywhere on the 'net is able to resolve this!!

The thing that is really annoying me is that my dev system, that is on a separate computer to the actual DB server, WORKS! It only breaks when the ASP pages are hosted on IIS on the same server as the DB server!!!! I'm unsure if this is a .NET config or security thing, or something else on the server.

Is it a bug with the DB driver????

Best regards,
AstroTux.
Reply With Quote
  #3  
Old 05-02-2008, 06:46 PM
AstroTux's Avatar
AstroTux AstroTux is offline
Junior Contributor
 
Join Date: Aug 2007
Posts: 345
Default

ARRRGHHHH!!!

The spaces in the connect string are screwing it up!! Even though it is taking the username and password and apparently logging into the database, it is preventing it seeing which database I want to deal with!!!!!!!

This does NOT work:

Code:
Dim dbCS As String = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=<SERVER>; UID=<USERNAME>; PASSWORD=<PASSWORD>; DATABASE=<DATABASE>; PORT=3306"



But this DOES:

Code:
Dim dbCS As String = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=<SERVER>;UID=<USERNAME>;PASSWORD=<PASSWORD>;DATABASE=<DATABASE>;PORT=3306"
I hope it helps someone!

Remember: NO SPACES!!!

Best regards,
AstroTux.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error &quot;No database selected&quot; Error
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error &quot;No database selected&quot; Error &quot;No database selected&quot; Error &quot;No database selected&quot; Error &quot;No database selected&quot; Error &quot;No database selected&quot; Error &quot;No database selected&quot; Error
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error
 
&quot;No database selected&quot; Error
&quot;No database selected&quot; Error
 
-->