Accessing the server via linux

Asked

Viewed 61 times

0

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

Could someone explain to me how to do this?

The class of connection 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 on Linux, I’m new to Linux.

  • Have you tried connecting via pgAdmin?

1 answer

1

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

  • jdbc:sqlite:meu_banco.db
  • jdbc:sqlite://dira/Dirb/meu_banco.db
  • jdbc:sqlite:/DRIVE:/dira/Dirb/meu_banco.db
  • jdbc:sqlite://PC/shareA/Dirb/meu_banco.db

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

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

You have to create a file sharing on the server, which is not recommended, as it may open a breach in your system’s security.

Sqlite is not recommended for client/server applications. For this, use another DBMS. Use Mysql or Postgresql (I prefer Postgresql).

  • 1

    Doubled jdbc:sqlite:jdbc:sqlite:///...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.