wood burning stoves*
The moose likes JDBC and the fly likes Data source name not found and no default driver specified Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data source name not found and no default driver specified " Watch "Data source name not found and no default driver specified " New topic
Author

Data source name not found and no default driver specified

amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124


I am getiing above said error. Saying SQLException...


Thanking in advance...


[BSouther: Added UBB CODE tags]
[ April 09, 2007: Message edited by: Ben Souther ]

Thanks advance who ever answers this question.


regards
amit bhadre
Talhah Mafawalla
Greenhorn

Joined: Nov 05, 2006
Posts: 24
Hi amit,

Did you create a DSN before you ran the code.

To create a DSN called "TEST" do the following:
1. Click Start in windows and select run or open comand promt.
2. Type "odbcad32" and press enter.
3. When the "ODBC data source administrator" opens click on "Add".
4. In the window "Create new data source" select "Microsoft Access Driver (*.mdb)" then click finish
5. In the window "ODBC Microsoft access setup", type "TEST" into the "Data source name" text box.
6. Next click "Select" under "Database", then browse and select you Microsoft access databse and click "Ok".
7. Then click "Ok" on the "ODBC Microsoft access setup" window.
8. Then click "Ok" on the "ODBC data source administrator" window.
9. Re run the page.

I hope this is what you were looking for.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Since the ODBC-JDBC bridge ships with Java, there is nothing particular to Servlets or JSP that needs to be done when using it.
For this reason, I think this issue really belongs in the JDBC forum.
Moving....


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeff Ash
Greenhorn

Joined: Apr 07, 2007
Posts: 11
A couple of important notes about ODBC DSN's:

First, make sure that you create a "System" DSN whenever the calling code is located inside a service. Since you're using a Web server (Tomcat or something similar I assume?) and thus probably running it as a service, you need to make sure your DSN is a System DSN, NOT User. The service cannot access a user DSN unless you happen to create the user DSN as the same user that the service is running as. However, it's best just to make it a system DSN. Also, you can use a File DSN if you need to, as they work like system DSNs.

Second, DSN names are case sensitive. So, if your DSN is named "Test" and you try to use the connect URL of jdbcdbc:TEST, it will fail.


Jeff Ash<br /><a href="http://www.excellentiasoftware.com" target="_blank" rel="nofollow">Excellentia Software</a>
amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
Yes I created DSN as told by discussion.Still its not connecting? Whats might be the problem...Is it CLASSPATH variable problem or any other?



thanking in advance...
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by amit bhadre:

I am getiing above said error. Saying SQLException...


It would be better if you test your code by running a .class file. create a java file with your database connection code then test it.

and one more thing paste your stack trace here whatever you are getting in SQLException. it could be more help to find out the error shortly.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Data source name not found and no default driver specified
 
Similar Threads
How to separate Business Logic from the servlet
javax. servlet. Servlet Exception: java. sql. SQLException
Error while connecting to database
error showing while retrieving the data from drop down list
Error while forwarding page