[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Java Applet Conneting to MSAccess Database

Posted on 1997-06-24
2
Medium Priority
?
296 Views
Last Modified: 2013-11-23
How could I connect a java applet to an Access Database File?
I need to write an applet to search a list of phone numbers,email addresses and server them to the person who accessed the web page. I am a relative beginer so the more complete the answers the better.
0
Comment
Question by:Sean Milne
[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
2 Comments
 
LVL 6

Accepted Solution

by:
jpk041897 earned 300 total points
ID: 1222097
The answer to your question is really to extensive to answer completley in this forum so I'll just give you some pointers you can pursue, and then you can clarify your doubts via additional comments to this question.

For Java to access a Data Base of any kind, you need to use JDBC (included in the JDK1.1 release and downloadable from sun for 1.02).

For an Access database, you would need the JDBC-ODBC bridge (which is part of JDBC) and an ODBC driver for MS Access.

There are several good resources you can read to learn how to use JDBC. Amongst them, online, take a look at:

http://www.mcp.com/que/et/se_java2e/43javafi.htm

http://www.mcp.com/que/et/se_java2e/44javafi.htm

http://www.mcp.com/que/et/se_java2e/45javafi.htm

http://splash.javasoft.com/jdbc/#The JDBC Release 1.2

and if you are looking for Java DB development tools you might want to look at:

http://www.xdb.com/home.htm

The info contained in these pages should be enough to get you started. And leave you in a position in which you can ask more specific questions that could lead to a conclution.

Feel free to post as many clarification comments as you wish, and  if at any time during the process you believe my comments are not addressing your needs, grade me with an F to handoff your question to another "expert".
0
 

Expert Comment

by:suhai
ID: 1222098
Java Applet can connect to MSAccess Database using JDBC-ODBC. If you using JDK1.1.1 just include in classpath(autoexec).
You have to download JDBC package if using JDK1.02. To communicate your applet & your database on browser, i suggest you Symantec dbAnywhere Server(Netscape only). Please refer to  
http://www.symantec.com 
check the documentation for dbAnywhere (configuration C for MSAccss) & download Trial dbAnywhere Server for testing.

SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\Jdk1.1.1\Bin;c:\jdk1.1.1\jdbc\classes\sun\jdbc\odbc;"%PATH%"
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\jdk1.1.1\lib;C:\jdk1.1.1\jdbc;C:\jdk1.1.1\jdbc\classes;"%PATH%"
SET PATH=C:\dbANYWHERE Server\redist\dbaw.zip;C:\dbANYWHERE Server\redist\sql.zip;"%PATH%"

SET CLASSPATH=.;C:\JDK1.1.1\LIB\CLASSES.ZIP;C:\dbANYWHERE Server\redist\dbaw.zip;c:\dbANYWHERE Server\redist\sql.zip

Java applet/application:
public void setup()
{
 Connection myConnection;
 Statement myStmt;
 String url = "jdbc:odbc:yourdatabase"; //yourdatabase is example
 try                                  //use your own                                       //  source database
 {      
   Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
   myConnection = DriverManager.getConnection(url, " ", " ");
   myStmt = myConnection.createStatement();
 }
 catch (java.sql.SQLException e){
      System.out.println("SQL Pass Exception");
 }
 catch (java.lang.Exception e2){                          System.out.println("Java Lang Pass Exception");      
 }
}
for dbAnywhere connection:
driver =(Driver)Class.forName("symantec.itools.db.jdbc.Driver").newInstance();
DriverManager.registerDriver(driver);
String url = "jdbc:dbaw://192.168.0.9:8889/MS_Access/newdatabase/newdatabase";

String user = " ";
String password = " ";
con = DriverManager.getConnection(url,user,password);
stmt = con.createStatement();
   

You have to setup your database in Control Panel 32bitODBC and add MSAccess Driver .mdb(then select your database)
You can use SQL language to insert,delete,update from database
ex: Resutselt myresult;
    try{
      string sql = "select * from Emloyee where ....";
      myresult = myStmt.executeQuery(sql);  
      while(myresult.next())
      {
           myResult.getString("staffid");
      }
     catch (java.sql.SQLException e){
      System.out.println("SQL Pass Exception");
      }
     catch (java.lang.Exception e2){                                  System.out.println("Java Lang Pass Exception");      
     }

I suggest you to use Visual Cafe Pro to build & compile your applet.

I hope this help.

Pablo.


0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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

650 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