关于JDBC驱动程序的问题
我用的数据库是mysql for windows版,我先
用mysqld启动mysql数据库服务器,然后运行下面程序:
import java.sql.*;
class SimpleExample
{
public static void main(String args[])
{
String url="jdbc:odbc:mydata";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection=DriverManager.getConnection
(url,"myid","mypasswd");
String sql="select * from name";
System.out.println("native form:"+
connection.nativeSQL(sql));
Statement statement=connection.createStatement();
ResultSet rs=statement.executeQuery(sql);
connection.close();
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
为何会出现:“java.sql.SQLExecption:[Microsoft][ODBC驱动程序管理器]未发现数据源名称并且未指定默认驱动程序”,但是数据源"mydata"的确存在,是不是驱动程序有问题,请各位高手赐教!
在此先谢了!!!