• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File Dsn Problem?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using the JDBC-ODBC bridge with MySQL? Would it not just be easier to use a type 4 driver?
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic