According to the response @Barmaley, given the issue of driver Installation for postgresql on linux , I created
Sample.jar the same file
Sample.java , illustrated in the above page, with manifest file
Manifest-Version: 1.0 Created-By: 1.7.0_06 (Oracle Corporation) Main-Class: Sample Class-Path: /folder/postgresql-8.4-703.jdbc3.jar
and the file
/folder/postgresql-8.4-703.jdbc3.jar and has started using the jar c
./ java -jar -Djava.library.path = / opt / jdk1.7.0_06 / lib / Samplejavaprogram / Sample. jar
and as a result received the following message
Connection Failed! Check output console java.sql.SQLException: No suitable driver found for jdbc: postgresql: //192.168.1.8: 5432 / NexentaSearch at java.sql.DriverManager.getConnection (DriverManager.java:604) at java.sql.DriverManager.getConnection (DriverManager.java:221) at org.myorg.Sample.main (Sample.java:33)
I ran the file from the host with the address
192.168.1.10 , but the host
192.168.1.8 it worked fine.
(I changed the program by removing the first 2 lines:
Help to correct the error.
Answer 1, Authority 100%
It looks like the problem is that you do not load the JDBC driver.
p.s. Download Statement Intellij IDEA Community Edition and work in it – life becomes a lot easier