This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Regarding Servlet connectivity with ms-access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Regarding Servlet connectivity with ms-access" Watch "Regarding Servlet connectivity with ms-access" New topic

Regarding Servlet connectivity with ms-access

sharma sachin

Joined: Nov 13, 2009
Posts: 24
I have created one simple Servlet file that insert the records in the database
I have used ms-access as back-end but when I try to insert the records it is giving an exception
that no data source name or default odbc driver not found
however same thing works when I try to insert the records using main() method on console
(means same concept works properly when I try to insert the records using swing form)
but using servlet it is giving an exception

Can anyone solve my query???
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 540
How are you connecting to the datasource? I presume you must be using JDBC_ODBC driver, can you please share the part of the code that connects to the database?
Also post the exception. After looking at it we might be able to get some clue.

sharma sachin

Joined: Nov 13, 2009
Posts: 24

the above code generates an exception:
exception=java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

however same dsn works while connecting the swing form with MS-ACCESS
means data is inserting successfully while using the swing form
anirudh jagithyala
Ranch Hand

Joined: Dec 07, 2010
Posts: 41
Did you create user DSN with only name hello and select the corresponding .mdb database....

PreparedStatement pstmt=con.prepareStatement("insert into myTable values(?,?)");

The prpared statement needs to be given values before its executed....

between line 24 and 25

If you are using vista sometimes you would get driver problems , i had a similar issue which worked in other windows OS but not vista
try updating drivers.

Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Lets start debugging to find where this little code giving you an stupid error.

To create and DSN please follow 'Control Panel ->Administrative tools ->Data Sources(ODBC) ->System DSN ->Add'
and make sure to create system DSN instead of user.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Regarding Servlet connectivity with ms-access
jQuery in Action, 3rd edition