File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Exception" Watch "SQL Exception" New topic
Author

SQL Exception

Ola gharably
Greenhorn

Joined: Jul 01, 2003
Posts: 10
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.
Ulrich Freyer-Hirtz
Greenhorn

Joined: Jun 30, 2003
Posts: 1
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
 
wood burning stoves
 
subject: SQL Exception
 
Similar Threads
JDBC with MS SQL 2000
How to connect Driver
how to connect MS Access directly
JDBC require EE?
JDBC Driver error