This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Dynamic DSN not working 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 "Dynamic DSN not working" Watch "Dynamic DSN not working" New topic
Author

Dynamic DSN not working

Willy Ray
Greenhorn

Joined: May 04, 2008
Posts: 11
Hey all, I tried the instructions listed here: Dynamic DSN instructions

They're not working for me for some reason.



It works if I getConnection(url), using the system DSN "notes", but if I try to do it on getConnection(DB_URL_PREFIX), I get this:

java.sql.SQLException: General 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 #my package redacted#.model.DAO.getConnection(DAO.java:21)
at #my package redacted#.model.DocumentGateway.getNextDocumentId(DocumentGateway.java:14)
at #my package redacted#.model.DocumentManager.getNextDocumentId(DocumentManager.java:19)
at #my package redacted#.CompAnnotate.<init>(CompAnnotate.java:150)
at #my package redacted#e.CompAnnotate.main(CompAnnotate.java:59)


I've tried every possible variant of the path separator, including, \, \\, /, and File.pathSeparator. I've tried it with and without the ";DriverID=22;READONLY=false";" suffix. Always the same error.

Any ideas?

/willy
Willy Ray
Greenhorn

Joined: May 04, 2008
Posts: 11
Did you ever notice how talking about a problem to a different group of people sometimes makes you see it in a different way? After I posted this (just now), I got thinking about the NAME of the driver. So, I poked around in my system settings, and found that all my static DSNs that pointed to Access files referenced the name of the driver as:

MicroSoft Access Driver (*.mdb)

I looked again at my code, copied in part from the instructions, and found that it indicated:

{MicroSoft} Access Driver (*.mdb)

Slight difference, those curly braces. Could that be the problem?

Turns out it is. I'm now Dynamic DSN-enabled.

I'd suggest updating those instructions to indicate possible differences in name of driver for .mdb.

Thanks!

/willy
 
Don't get me started about those stupid light bulbs.
 
subject: Dynamic DSN not working
 
Similar Threads
Issue with Date insertion
SQLException on connect
DSN less MS access Connection using JSP - help needed
DSN-Less MSAccess connection issues
Trying to access to Microsoft Access from my java program.