import java.sql.*;
public class dsn
{
public static void main(
String[] args)
{
Connection con;
Statement st;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("Jdbc:Odbc:ex");
System.out.print("Connection Successful");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
The file DSN was set up using the xp ODBC administrator and it is in the default location of:
C:\ProgramFiles\CommonFiles\ODBC\DataSources
and is called "ex.dsn" - it looks like this
[ODBC]
DRIVER=MySQL ODBC 5.1 Driver
UID=root
PORT=3306
DATABASE=harsh
SERVER=localhost
This is error message,how i solve it?
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"