File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Servlet connectivity with ms-access

 
sharma sachin
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
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
Posts: 544
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.

regards,
amit
 
sharma sachin
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you create user DSN with only name hello and select the corresponding .mdb database....



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


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

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
Posts: 1324
Android Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic