Clicky

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.

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

Database Connection
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
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();	

		try

		{
			// load the JDBC-ODBC bridge driver
			Class.forName(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);
		}

        }
}


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



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

asked 10/26/2011 10:22

gregg_s's gravatar image

gregg_s ♦♦


5 Answers:
There are issues with OS and 32/64 processor architecture and the Access drivers. e.g. see

http://stackoverflow.com/questions/3808633/troubles-with-jdbc-odbc-dsn-less-connection-strings-and-64-bit-windows-7
link

answered

CEHJ's gravatar image

CEHJ

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?
link

answered 2011-10-27 at 01:49:37

gregg_s's gravatar image

gregg_s

>>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...
link

answered 2011-10-27 at 04:56:09

CEHJ's gravatar image

CEHJ

Out of interest, why were you going for Access?
link

answered 2011-10-27 at 05:19:27

CEHJ's gravatar image

CEHJ

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
link

answered 2011-10-27 at 05:20:15

gregg_s's gravatar image

gregg_s

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×60
×1
×141

Asked: 10/26/2011 10:22

Seen: 246 times

Last updated: 10/27/2011 03:09