This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes How to connect Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to connect Driver" Watch "How to connect Driver" New topic

How to connect Driver

eric lee
Ranch Hand

Joined: Nov 04, 2002
Posts: 86
When i run java Test,it shows error message,
how can i solve it? Thanks.
[ODBC Driver Manager]Data source name not found
and no default driver specified
import java.sql.*;
public class Marking{
public static void main(String[] args) {
// Load the driver
try {
// Load the driver class

// Define the data source for the driver

String sourceURL = "jdbc dbc:bookbase";
// Create a connection through the DriverManager
Connection databaseConnection =
// We made it!
System.out.println("Connection established successfully!");
// close connection
catch (ClassNotFoundException cnfe) {
catch (SQLException sqle) {
kishor rao
Ranch Hand

Joined: Dec 10, 2002
Posts: 35
I changed the datasource name to one I have on my system and it compiled and executed without any glitches.
Make sure you have set up the ODBC connection properly.
kishor rao
Ranch Hand

Joined: Dec 10, 2002
Posts: 35
If you have run the program as java test...thats wrong. I dont know where the test class is. You should run it as java Marking.
I agree. Here's the link:
subject: How to connect Driver
jQuery in Action, 3rd edition