[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Why does DSNLess database connection works on one pc, not another?

Posted on 2011-10-26
Medium Priority
Last Modified: 2013-11-23
Hi Experts,

I have created a dsnless database connection that works on my computer. It does not work on another computer My question is what are some possible things to look at to debug the issue? I have no interest in creating a DSN. Id like to get the dsnless working.

Thank you. Gregg.

How i transfered program from one computer to other:
I zipped the entire eclipse project, sent to class mate, and he extracted. It doesnt work. Entire file structure should have been preserved.

I use windows xp. He uses Windows 7 or vista - i can ask which if necessary.

Database Connection
public class ContactsDatabase
        Connection connection = null;
	final String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
	String myDB ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";		
	final String username = "";
	final String password = "";

	public ContactsDatabase()
		//Locate the access database and get the path url
		File myFile = new File("contactaddress.mdb");
		myDB += myFile.getAbsolutePath();	


			// load the JDBC-ODBC bridge driver
			//use the DriverManager to create a Connection object
			connection = DriverManager.getConnection(myDB, username, password);
                        System.out.println("Successfully Connected to " + myDB);
		catch(ClassNotFoundException e)

			System.err.println("Database driver not found.");
		catch(SQLException e)
			System.err.println("Error connection to the database: " + e);


Open in new window

Error connection to the database: java.sql.SQLException: 
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Open in new window

URL output: jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Users/Gary/myJava/contactaddress.mdb (which is correct url to db).

Question by:Gregg
  • 3
  • 2
LVL 86

Accepted Solution

CEHJ earned 2000 total points
ID: 37036690
There are issues with OS and 32/64 processor architecture and the Access drivers. e.g. see

LVL 10

Author Comment

ID: 37037282
Thanks CEHJ, i think for now we will just accept it for what it is..."another reason not to use MS products."

As for his solution, he installed a 32bit JRE. Does that mean the 64 bit was uninstalled? Can you have 2 JRE's installed?
LVL 86

Expert Comment

ID: 37037373
>>Thanks CEHJ, i think for now we will just accept it for what it is..."another reason not to use MS products."

Absolutely. Try to avoid closed source 'databases'

>>Does that mean the 64 bit was uninstalled?

Not sure

>>Can you have 2 JRE's installed?

Yes. Although, which one should be active or loaded is another issue...
LVL 86

Expert Comment

ID: 37037378
Out of interest, why were you going for Access?
LVL 10

Author Comment

ID: 37038021
I am taking advanced java classes at local community college to keep learning. The instructor said use access, i think because its available on all campus computers. For anything i would work on myself personally, i would use mysql on ubuntu linux (which im new at) or SQL Server which we have at work (and i am comfortable with).

Thanks for your help! Gregg

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question