Accessing the server through linux

0

I would like with my Java application (netbeans) to access the database that is on the server, but this was complicated because it is through a Linux machine.

Could someone explain to me how to do this?

The connection class I use is:

public Connection LigaBD() {
    try{
        System.out.println("Entrei !!!");
        Class.forName("org.sqlite.JDBC");
        conn = DriverManager.getConnection("jdbc:sqlite:pesquisa.db");
        System.out.println("Passei a segunda fase !!!");
    }
    catch(Exception e){
        e.printStackTrace();
    }
    System.out.println("Nao consegui entrar na BD");
    return null;
}

Accessing locally I can, the worst is mapping in Linux, I'm new to Linux.

    
asked by anonymous 19.05.2014 / 16:40

1 answer

1

You connect to your database using one of the following ways:

  • jdbc: sqlite: my_banco.db
  • jdbc: sqlite: //dirA/dirB/meu_banco.db
  • jdbc: sqlite: / DRIVE: /dirA/dirB/meu_banco.db
  • jdbc: sqlite: ///COMPUTADOR/shareA/dirB/meu_banco.db

In case the solution to your problem would be using the last form:

conn = DriverManager.getConnection("jdbc:sqlite:jdbc:sqlite:///NOME_SERVIDOR/caminho_do_arquivo/pesquisa.db");

You have to create a file share on the server, which is not recommended as it can breach your system's security.

SQLite is not recommended for client / server applications. For this, use another DBMS. Use MySQL or PostgreSQL (I prefer PostgreSQL).

    
30.05.2014 / 15:48