This discussion is archived
1 Reply Latest reply: Dec 20, 2012 4:46 PM by jschellSomeoneStoleMyAlias RSS

odbc Connection network

975668 Newbie
Currently Being Moderated
Hi,

How can I create a network connection to access?

My connection work in local eg: "c:/..." but not in network "\\server\"
public void conectar(String caminhoarquivo){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Properties ppt = new Properties();
ppt.put("charSet", "ISO-8859-1");
conexao = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+caminhoarquivo, ppt);
}catch(Exception e){
JOptionPane.showMessageDialog(null, "o Erro aconteceu na conecção");
// System.out.println("ERRO na Conexao com o Banco de Dados"+e.toString());
}
}
  • 1. Re: odbc Connection network
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    972665 wrote:
    Hi,

    How can I create a network connection to access?
    Basically you can't.

    The MS Access odbc driver relies on the file system to access the db file.

    So if you can't open explorer (nothing to do with java) and see the file then neither can the MS Access odbc driver.

    Your options are
    - Expose the file via the file system.
    - Run a proxy application on the remote box (it has file access) and then use a proxy driver from the client app.
    - Use a different database.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points