By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,262 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,262 IT Pros & Developers. It's quick & easy.

Accessing MS-Access from Solaris and AIX

P: n/a
Hi:
I am using Sun JdbcOdbcDriver to access MS-Access from Java client on
Windows platform. We are in the process of migrating from Win to
Solaris and AIX platform. MS-Access will continue to reside on Win
platform. How can I access MS-Access from Java client on Solaris and
AIX? Can I still use Sun JdbcOdbcDriver?. What drivers or files do I
need on Solaris and AIX platforms? If Sun JdbcOdbcDriver for MS-Access
is not possible on these platforms, please let me know alternatives.
(I can't change database product)

Thanks,
Vasanth
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
bv*********@rediffmail.com (Vasanth) wrote:
I am using Sun JdbcOdbcDriver to access MS-Access from Java client on
Windows platform. We are in the process of migrating from Win to
Solaris and AIX platform. MS-Access will continue to reside on Win
platform. How can I access MS-Access from Java client on Solaris and
AIX? Can I still use Sun JdbcOdbcDriver?. What drivers or files do I
need on Solaris and AIX platforms? If Sun JdbcOdbcDriver for MS-Access
is not possible on these platforms, please let me know alternatives.


If it's read only the following might work.

MDB Tools is a set of libraries and utilities to facilitate exporting data from MS
Access databases (mdb files) without using the Microsoft DLLs. In other words they
are reverse engineering the layout of the MDB file. mdbtools.sourceforge.net

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 13 '05 #2

P: n/a
Here is a snipet from a class I wrote in Java which interfaces with MS
Access. Most of it is probably gobbledeegupe for your purposes. But
there is a connection string in here that might be of interest to you,
and I am also using the Sun ODBC driver to connect to Access. Note:
you have to create a DSN for this to work. The rest of the variables
are just Java objects for Recordsets and Query statements. Also, a lot
of the code lines here are wordwrapping. In Java, the end of a code
line is defined by a semicolon ";", and routines are enclosed in curly
braces {}.
package bugs3;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.sql.*;

public class DBFunctionServ extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
doPost(request, response);
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String btn = request.getParameter("btn");
String priority = request.getParameter("priority");
String status = request.getParameter("status");
String hours = request.getParameter("hours");
int hour = 0;
int submitterID = 0;
int rowcount = 0;
if(hours == null)
hours = "0";
try{
hour = Integer.parseInt(hours);
}catch(NumberFormatException nfe){}
String description = request.getParameter("description");
String submitter = request.getParameter("submitter");
if(submitter == null)
submitter = "0";
try{
submitterID = Integer.parseInt(submitter);
}catch(NumberFormatException nfe){}

if(priority == null)
priority = "";
if(status == null)
status = "";
if(description == null)
description = "";

String bgcolor = null;
Cookie[] cookies = request.getCookies();
if(cookies != null){
for (int i=0; i<cookies.length; i++ ){
Cookie cookie = cookies[i];
if (cookie.getName().equals("bgcolor") ){
bgcolor = cookie.getValue();
System.out.println("bgcolor is " + bgcolor);
}
}
}
//BugDB is the ODBC DSN set in control pannel
String dsn = "jdbc:odbc:;DRIVER=Microsoft Access Driver
(*.mdb);DBQ=BugsDB";
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
out.println("<html>");
out.println("<head><title>DBFunctionServ</title></head>");
if(bgcolor != null)
out.println("<body bgcolor=" + bgcolor + ">");
else
out.println("<body>");
try{
Class.forName(driver);
Connection con;
con = DriverManager.getConnection(dsn);
Statement stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSIT IVE,ResultSet.CONCUR_R
EAD_ONLY);
if(btn.equals("Display") || btn.equals("Find"))
{
String sql = "SELECT * FROM BugsTbl";
if(btn.equals("Find"))
sql = "SELECT * FROM BugsTbl WHERE Priority = '" + priority +
"'";
ResultSet rs = stmt.executeQuery(sql);
//rs.setFetchDirection(rs.TYPE_SCROLL_INSENSITIVE);

rs.last();
rowcount = rs.getRow();
rs.beforeFirst();

ResultSetMetaData md = rs.getMetaData();
int nFields = md.getColumnCount();
//out.println("<html>");
//out.println("<head><title>DBFunctionServ</title></head>");
//if(bgcolor != null)
// out.println("<body bgcolor=" + bgcolor + ">");
//else
// out.println("<body>");
out.println("column count is " + nFields + "<br><br>");
out.println("<table border=1>");
for(int i = 1; i <= nFields; i++)
{
String str1 = md.getColumnName(i);
System.out.print(" *" + str1 + "* ");
out.println("<th>" + str1 + "</th>");
}
out.println("<th>RowCount</th>");
System.out.println("\n");
while(rs.next())
{
out.println("<tr>");
for(int i=1; i <= nFields; i++)
{
String str1 = rs.getString(i);
out.println("<td>" + str1 + "</td>");
}
out.println("<td>" + rs.getRow() + "</td>");
out.println("</tr>");
}
//int rowcount = rs.getRow();
out.println("</table><br>");
if(btn.equals("Find")){
if(priority.equals(""))
out.println("no records to display for selected priority
parameter of *" + priority + "*");
else
out.println("<br>Count of rows is " + rowcount + " for the
priority parameter of *" + priority + "*");
}else
out.println("Count of records is " + rowcount);
}
else
{
if(btn.equals("Add")){
stmt.executeUpdate("INSERT INTO BugsTbl(Priority, Status,
Hours, Description, SubmitterID) "
+ "VALUES('" + priority + "', '" + status +
"', " + hour + ", '"
+ description + "', " + submitterID + ")");
out.println("record added");
}
if(btn.equals("Remove")){
stmt.executeUpdate("DELETE FROM BugsTbl WHERE Hours = " +
hour);
out.println("Record removed for Hours = " + hour);
}
if(btn.equals("Update")){
stmt.executeUpdate("Update BugsTbl Set Description = '" +
description + "' WHERE BugsID = " + hour );
out.println("Record updated for BugsID = " + hour);
}
}
//out.println("<p>The servlet has received a POST. This is the
reply.</p>");
//out.println("</body></html>");
con.close();
System.out.println("btn is " + btn);
}catch(Exception e){e.printStackTrace();}
//out.println("<p>The servlet has received a POST. This is the
reply.</p>");
out.println("</body></html>");
}
//Clean up resources
public void destroy() {
}
}

Rich

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

P: n/a
bv*********@rediffmail.com (Vasanth) wrote in
news:4a*************************@posting.google.co m:
I am using Sun JdbcOdbcDriver to access MS-Access from Java client
on Windows platform. We are in the process of migrating from Win
to Solaris and AIX platform. MS-Access will continue to reside on
Win platform. How can I access MS-Access from Java client on
Solaris and AIX? Can I still use Sun JdbcOdbcDriver?. What drivers
or files do I need on Solaris and AIX platforms? If Sun
JdbcOdbcDriver for MS-Access is not possible on these platforms,
please let me know alternatives. (I can't change database product)


You're not using Access.

You're using Jet, the database engine behind Access.

You may have used Access to create the MDB file you are using, but
if it's not on Windows, then Access is not involved.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4

P: n/a
There will be no problems with the migration, provided that you can
physically see the Access mdb files after the move. You can do this
in many different ways including NFS, Samba, or just doing regular
ftp's of the file. Your client side Java will be able to access the
mdb file through the bridge just as it did under Windows. Let me know
if you have problems.

bv*********@rediffmail.com (Vasanth) wrote in message news:<4a*************************@posting.google.c om>...
Hi:
I am using Sun JdbcOdbcDriver to access MS-Access from Java client on
Windows platform. We are in the process of migrating from Win to
Solaris and AIX platform. MS-Access will continue to reside on Win
platform. How can I access MS-Access from Java client on Solaris and
AIX? Can I still use Sun JdbcOdbcDriver?. What drivers or files do I
need on Solaris and AIX platforms? If Sun JdbcOdbcDriver for MS-Access
is not possible on these platforms, please let me know alternatives.
(I can't change database product)

Thanks,
Vasanth

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.