Solved

Java Servlet & MS Access

Posted on 2000-03-09
10
323 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
  • 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

930 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now