English 中文(简体)
与MySQL连接造成错误,“没有发现数据来源名称,也没有具体规定违约司机”
原标题:Connecting to MySQL causes error "Data source name not found and no default driver specified"

I m trying to connect to a MySQL database using my ASP.NET Web Forms Application. I m carrying out a test to Bind the data from the MySQL database to a GridView.

我的守则是:

Dim strMySQLConn As String = "DRIVER={MySQL ODBC 5.1 Driver};Database=database_name;Server=ip_address;UID=username;PWD=password;"
    Dim MySQLConn As New OdbcConnection(strMySQLConn)

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then

            Dim ds As DataSet = New DataSet()
            Dim cmdMySQL As New OdbcDataAdapter("SELECT * FROM categorymaster", MySQLConn)

            MySQLConn.Open()

            cmdMySQL.Fill(ds, "prjs")

            gv.DataSource = ds.Tables("prjs").DefaultView
            gv.DataBind()


            MySQLConn.Close()

        End If
    End Sub

然而,当MySQL数据库连接(MySQLConn.Open()时,将下列错误退回:

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

Why is this and how can I prevent it from happening?

而且,看到这一错误的可能原因是什么? 如果 log证书不正确,是否会显示这一错误?

最佳回答

The issue was caused because I was installing a 64-bit MySQL ODBC 5.1 Driver, because my OS is running 64 bit.

由于我曾试图用几天时间解决这一问题,我用长枪把司机删除,并安装了<代码>32-bit。 MySQL ODBC 5.1 司机。

This has fixed the error and I m now making a successful connection.

问题回答

Curt was right. I was having this exact issue. Since I had MySQL Workbench installed on my workstation, I assumed I had the drivers installed; Nope. Installing the driver plus calling it by the correct version, and adding command "Provider=MSDASQL;" to the connection string due to the fact that I m on a 64-bit system solved the issue for me. If you want to see all the ODBC drivers installed on your Windows system, open the registry editor to:

HongEY_LOCAL_MACHINESOFTWAREODBCINST.INIODBC 司机。

如果安装了MySQL驾驶员,如果是的话,就会发现他的正确名称。

rel=“nofollow” Owner=”这一链接> 这一链接将把你带到MySQL驾驶员下载网站。

您不妨检查是否安装了司机。 此处为清单的指南。

检查你是否安装了设备,并确保你的版本与你在座的版本相符。

http://dev.mysql.com/downloads/linkor/odbc”rel=“nofollow”

我的解决办法是“找不到数据来源名称”(有5.2.4 ODBC ansi司机,Win7 64bit):

1) Install 64bit ODBC MySQL driver - it should be visible in ODBC Drivers.

2) Install 32bit ODBC MySQL的司机——在ODBC的司机中看不到这一点,但在方案档案中制造了一个“影子”安装。

所有这一切都是如此。

My problem was that I had on my code

DRIVER={MySQL ODBC 5.3司机},但当我看过ODBC trough 窗户搜索引擎时,我发现了一个叫做ODBC 数据来源的信号,在 司机<>/em>的表格下,发现发动机的名称是{MySQL ODBC 5.3 ANSI}。 这就确定了问题。

Im把java 7与ODBC连接起来,为我工作

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionString = "jdbc:odbc:"DRIVER={MySQL ODBC 8.0 Unicode Driver};DSN=refde;Trusted_Connection=Yes;";




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!