?
Solved

Java Servlet & MS Access

Posted on 2000-03-09
10
Medium Priority
?
352 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
Technology Partners: 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 600 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 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