• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

SQL Exception

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
well, this is the first for me to try making connection between java and databases using MSAccess.
1. first of all I downloaded jdk1.3.1 and Fortee for java, release 2.0 in order to , before starting real work, try an example.
2. I've changed my path to be c:\jdk1.3.1\bin.
3. created the microsoft access application.
4.tried this very simple example :
import java.sql.*;
public class CreateCoffees extends Object {
public static void main (String args[]) {
String url = "jdbc dbc:CAFEJAVA";

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException ex){
System.err.println("ClassNotFoundException: ");
System.err.println(ex.toString());
}

try{
Connection con = DriverManager.getConnection(url);
}
catch (SQLException s){
System.err.println("SQL Exception: ");
System.err.println(s.toString());
}
}
}
after I run the code the following run time error appears:
SQL Exception:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
you need the DB Connection registered at the System Level. In WinXP go to System/Admnstration/DataSource and create a new DataSource with SystemDSN Name equals the name you are using in your Program.
Hope that helps
uli
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic