wood burning stoves 2.0*
The moose likes JDBC and the fly likes error when i run the program 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 "error when i run the program" Watch "error when i run the program" New topic

error when i run the program

sai donthneni
Ranch Hand

Joined: Mar 26, 2006
Posts: 50
This is the program and I am trying to connect to MS Access database.

import java.sql.*;

class jdbcDemo
public static void main(String args[])
String url="jdbcdbc:Part6";
Connection con=DriverManager.getConnection(url);
Statement stmt;
ResultSet rs=stmt.executeQuery("SELECT Auth_ID, Auth_Name FROM AUTHOR_t");

int i=rs.getInt(1);
String name=rs.getString(2);


catch(Exception e)


The Exception I am getting when I am running the program is

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not fou
nd and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at jdbcDemo.main(jdbcDemo.java:13)
[ August 09, 2006: Message edited by: sai donthneni ]
surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
check whether your DataSourceName is pointing to your database correctly or not.If not configure that correctly.

and use finally block to close your connection and statement.

SCJP 1.4
sai donthneni
Ranch Hand

Joined: Mar 26, 2006
Posts: 50
My datasource has been mentioned properly. Do I have to mention that it is on the localhost? My database name is Part6. Do I have to download the drivers seperately or do they come with the database server itself?
I agree. Here's the link: http://aspose.com/file-tools
subject: error when i run the program
Similar Threads
Reg: Writing Oracle JavaStored Procedures
how to access data in excel
Error in Automatic Creation of ODBC Data Source
Adding Database to application
JDBC-ODBC java.sql.SQLException: General error