| Author |
Regarding Servlet connectivity with ms-access
|
sharma sachin
Greenhorn
Joined: Nov 13, 2009
Posts: 23
|
|
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
Joined: May 14, 2004
Posts: 488
|
|
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
Joined: Nov 13, 2009
Posts: 23
|
|
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(?,?)");
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
Joined: Dec 06, 2005
Posts: 1318
|
|
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.
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
 |
|
|
subject: Regarding Servlet connectivity with ms-access
|
|
|