Solved

Java Servlet & MS Access

Posted on 2000-03-09
10
345 Views
Last Modified: 2013-11-24
hello

how can I access a MS Access database
from a servlet ?

please give me some examples
0
Comment
Question by:smike
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 7

Expert Comment

by:vladi21
ID: 2602399
u can use JDBC

Java Database Connectivity is a standard SQL database access interface, providing uniform access to a wide range of relational databases. It also provides a common base on which higher level tools and interfaces can be built. This comes with an "ODBC Bridge" (except on Mac 68K). The Bridge is a library which implements JDBC in terms of the ODBC standard C API.
http://java.sun.com/products/jdk/1.1/docs/guide/jdbc/index.html
http://java.sun.com/products/jdbc/index.html
http://java.sun.com/docs/books/jdbc/intro.html
http://java.sun.com/products/jdbc/faq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JDBC
http://java.sun.com/javareel/isv/Simba/products/jdbcfaq.html

Writing Advanced Applications Chapter 4: JDBC Technology
http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jdbc.html

This article covers the definition of database tables, use of Swing components, and gives a detailed code walkthrough with plenty of screen captures
http://developer.java.sun.com/developer/technicalArticles/Database/dukesbakery/

JDBC basics by Thornton Rose (example programs by April Rose)
http://www.gamelan.com/journal/techworkshop/060899_jdbc.html

JDBC and Database Programming in Java (good quick overview with images :)
http://www.purpletech.com/java/courses/jdbc/body.html

Silicaon Valley Java SIG JDBC Talk Page
http://www.hooked.net/~gturner/JDBCTalk.html

Java how-to DB section!
http://tactika.com/realhome/javaht/java-d1.html
http://codeguru.developer.com/java/Miscellaneous/Database/index.shtml
http://java.sun.com/products/jdk/1.3/ja/docs/ja/guide/jdbc/getstart/SimpleSelect.doc.html


articles from Oracle:
http://technet.oracle.com/tech/java/sqlj_jdbc/index.htm

articles from javaworld:
http://www.javaworld.com/javaworld/common/jw-ti-jdbc.html

JDBC 2.0 New Features
http://java.sun.com/products/jdk/1.3/docs/guide/jdbc/getstart/appendixA.html#1006294
http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/index.html

MS bridge
http://www.microsoft.com/Java/sdk/relnotes/JDBCrel.htm
http://msdn.microsoft.com/downloads/samples/Internet/author/datasrc/jdbcapplet/default.asp

Drivers:
http://java.sun.com/products/jdbc/drivers.html
http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jdbc.html#driver
http://tactika.com/realhome/javaht/java-d1.html#d8
ODBC Drivers, Servers, and Vendors
http://ourworld.compuserve.com/homepages/Ken_North/odbcvend.htm
JDBC Drivers, Servers, and Vendors
http://ourworld.compuserve.com/homepages/Ken_North/jdbcvend.htm
http://www.softsyn.com/Vendors.htm

http://www.idssoftware.com/jdriver.htm
Base source code to build your own JDBC driver http://dyade.inrialpes.fr/membres/gibello/JDBC/jdbcImpl.html 

Books online
http://www.itknowledge.com/reference/standard/1576100561/book-index.html
Java Database Programming with JDBC
http://www.itknowledge.com/reference/standard/1576100561/book-index.html
Java 1.2 Unleashed : Connecting to Databases with the java.sql Package
http://www.itknowledge.com/reference/standard/1575213893/ch44/ch44.htm

and some useful DB stuff:
InstantDB
http://208.234.21.207/

WebLogic JDBC (30 day trial)
http://www.beasys.com/download/weblogic.html 

http://www.thoughtinc.com/cocofree/doc/index.html 

http://www.agave.com/html/products/jdbc_dwnld.htm

--
--
DbVisualizer
http://www.pureit.se/products/dbvis/ 
DbVisualizer is a powerful Java tool for navigating one or many JDBC enabled databases simultaneously. It graphically visualizes relations between tables (for databases supporting referential integrity), it displays information about columns, indexes, primary keys, stored procedures and more. Any SQL statement can be executed using the SQL Commander and they can be organized and stored for subsequent use.

----
http://java.sun.com/products/jdbc/faq.html#5
How can I use the JDBC API to access a desktop database like Microsoft Access over the network?

Most desktop databases currently require a JDBC solution that uses ODBC underneath. This is because the vendors of these database products haven't implemented all-Java JDBC drivers.


The best approach is to use a commercial JDBC driver that supports ODBC and the database you want to use. See the JDBC drivers page for a list of available JDBC drivers.
The JDBC-ODBC bridge from Sun's Java Software does not provide network access to desktop databases by itself. The JDBC-ODBC bridge loads ODBC as a local DLL, and typical ODBC drivers for desktop databases like Access aren't networked. The JDBC-ODBC bridge can be used together with the RMI-JDBC bridge , however, to access a desktop database like Access over the net. This RMI-JDBC-ODBC solution is free. http://dyade.inrialpes.fr/mediation/download/
0
 
LVL 3

Expert Comment

by:rjackman
ID: 2603486
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.sql.*;

public class TestDatabase extends HttpServlet
{
      private Connection con;
      private Statement stmt;
      public void init(ServletConfig config)throws ServletException
      {
            super.init(config);
      }
      public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException

      {      ServletOutputStream out = res.getOutputStream();
            out.println("enteredin the method");
            String s = "CREATE TABLE IMAGE" + "(ADNO NUMBER(5) + ADNAME VARCHAR(10))";
            try{
                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");                  
            }
            catch(java.lang.ClassNotFoundException cnfe)
            {
                  System.err.println("error class not found");
            }
            
            try{
                  con = DriverManager.getConnection("jdbc:odbc:Image","ad","ad123");
                  out.println("Connected");
                  stmt = con.createStatement();
                  stmt.executeUpdate(s);
                  
                  stmt.close();
                  con.close();
            }
            catch(SQLException sqe) //catch(SQLException ex)
            {
                  System.err.println("sql exception");
            }
      }                        
      
}
0
 
LVL 3

Expert Comment

by:rjackman
ID: 2603499
here my servlet usese access data base where i have stored image table which contains details of iamges
>>con = DriverManager.getConnection("jdbc:odbc:Image","ad","ad123")
used fro connecting to data base :Image is DataSourceName which i have to configure through odbc configure option present in the control panel of windows
ad --usesrname for db
ad123 --password
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:muraliram
ID: 2603524
rjackman is correct
0
 

Author Comment

by:smike
ID: 2604414

rjackman,

your sevlet wrote "enteredin the method"
and thats all

do I need to install "JDBC-ODBC bridge" ?
0
 
LVL 7

Expert Comment

by:vladi21
ID: 2604434
smike: what is your server side? IIS?
0
 

Author Comment

by:smike
ID: 2604534

I have an Apache WWW Server and Apache JServ 1.1 on local machine, I have MS Access also

I'll copy all that stuff to a real server later

what is IIS ?
0
 
LVL 7

Expert Comment

by:vladi21
ID: 2604552
IIS - MS Inernet Information Server for NT

forget it :)

You can find all answers in my links
0
 
LVL 3

Accepted Solution

by:
rjackman earned 200 total points
ID: 2606876
i was using java web server
and u have to configure ur odbc bridge for database.u r not getting message as connected that means the connection to Db is not achieved so first configure db mean while i will try some other for u
Rjackman
0
 
LVL 3

Expert Comment

by:rjackman
ID: 2609632
thanx for appreciation
RiuckyJackman
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question