Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:24:19+00:00 2026-06-16T22:24:19+00:00

Here is my code: package dsnless; import java.sql.*; //////////////////////////////////////////////////////////// //This class will be used

  • 0

Here is my code:

package dsnless;
import java.sql.*;
////////////////////////////////////////////////////////////
//This class will be used to fire queries to the database
////////////////////////////////////////////////////////////
public class Query {
    public Query(){
        String pathToDatabase = "E:/Eclipse Projects/JDBC/src/datasouce/School.mdb";
        String database = "jdbc:odbc:Driver="+
                      "{Microsoft Access Driver(*.mdb,*.accdb)};" +
                      ":DBQ=" + pathToDatabase;
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con = DriverManager.getConnection(database);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        new Query();
    }
    Connection con;
    Statement s;
    ResultSet r;
}//class Query end  

Here is the exception:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] DRIVER keyword syntax error
    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 dsnless.Query.<init>(Query.java:14)
    at dsnless.Query.main(Query.java:20)  

And there is a new exception, too:

[Microsoft][ODBC Driver Manager] Data source name not found 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 dsnless.Query.<init>(Query.java:14)
    at dsnless.Query.main(Query.java:20)

Question

Please tell me what is wrong. I suspect it is the String database but stil it is only a guess.

Nailed it, myself

I changed the extensions supported from (*.mdb,*.accdb) to only (*.mdb) and it worked. Any idea as to why that happened???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:24:21+00:00Added an answer on June 16, 2026 at 10:24 pm

    You have an additional colon here, remove it

    String database = "jdbc:odbc:Driver="+
                  "{Microsoft Access Driver(*.mdb,*.accdb)};" +
                  ":DBQ=" + pathToDatabase;
                   ^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the server code package echoserver; import java.net.*; import java.io.*; public class EchoServer
Here is the code: package classes; import java.util.*; public class Introduction { Scanner Input
Hey everybody here is my code: package Chapter5; import java.util.Scanner; public class MainMenu extends
Here is my code: package survival; import javax.swing.*; import java.awt.*; public class Survival extends
Here's the code: package testpack; import java.io.*; public class InputStreamReadDemo { private void readByte()
Here is my code: package DavidPackages.Other; import java.util.concurrent.ConcurrentSkipListMap; public class SkipListTest { } Here
Here's my code package net.sourceforge.jwebunit.sample; import net.sourceforge.jwebunit.WebTestCase; public class JWebUnitSearchExample extends WebTestCase { public
here's the code package { import flash.display.MovieClip; import flash.events.MouseEvent; public class Main extends MovieClip
Here's my code: package com.eggproject_hu.WPECommerceAdminSales.client; import java.lang.Boolean; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Window; public class AblakVillogo
Here is my code: package AbstractClassesTwo; class X { private int n; public X(int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.