What's wrong with following code.tryuing to access MS access using JSP

i've cerated a database names TiH.mdb which has a table named TBL_TBL_FUNCTIONS
in the table there r thrree fields

now i 've just written the following code to access data from the table
but nothing gets displayed
what's wrong with the code??

<%@ page
      import = "java.io.*"
      import = "java.lang.*"
      import = "java.sql.*"
<% out.println("hello1");
      String      place;
      Connection dbconn;
      ResultSet results;
      PreparedStatement sql;
      int bus_fun_id,fun_id,name;
      String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=

      dbconn = DriverManager.getConnection(database);
      sql = dbconn.prepareStatement("SELECT * FROM TBL_FUNCTIONS");
      results = sql.executeQuery();
                  bus_fun_id = results.getInt("BUS_FUN_ID");
                        fun_id = results.getInt("FUN_ID");
                        name = results.getInt("BUS_FUN_NAME");

Kindly help
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Make sure it is able to connect to your database and are there any records in your table ?

And change the import to
<%@ page import="java.io.*,java.lang.*,java.sql.*" %>
hiteshgupta1Author Commented:
Thanx for ur help

now i m getting following error
Error: 500
Location: /examples/TiH/Temp.jsp
Internal Servlet Error:

javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
      at TiH.Temp_1._jspService(Temp_1.java:89)
      at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java)
      at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
      at org.apache.tomcat.core.Handler.invoke(Unknown Source)
      at org.apache.tomcat.core.Handler.service(Unknown Source)
      at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
      at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
      at org.apache.tomcat.core.ContextManager.service(Unknown Source)
      at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:536)

its not able to find the .mdb file.
try to give relative path of your .mdb file, avoid giving absolute path.
you should change the path to E:/Tools/Tomcat/webapps/examples/TiH/TiH.mdb
and make sure TiH.mdb is in specified path
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.


    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=



    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=E:\\Tools\\Tomcat\\webapps\\examples\\TiH\\TiH.mdb";

And consider not using Access... ;-)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you should close you connections and resources ath the end of  jsp :)
hiteshgupta1Author Commented:
definately sir:)
i'll take care of it!!
what was wrong with my solution ?
infact it works fine.
hiteshgupta1Author Commented:
avinthm thanx for ur help
actaul rpoblem was with the format in which i was pcefying the path
u said u should write comlete path "e:\tools\tomcat...)
but that didn't solved the problem
the corrcect solution was to write path as "E:\\tools\\tomcat....) ,means i have to use double slashes instead of single

once again thanx for ur concern and sorry too as i could not divide points between two ppl
> u said u should write comlete path "e:\tools\tomcat...)
i think u got my point wrong. i asked u to change the path....i have specified forward slash (/) instead of backward slash (\).

Anyway, your problem is solved. Thats more important than points. :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.