I am trying to install Postgres 9.3.16 on Windows7 (64 bit operating system). While Installing sqlj schema using pljava and the following command:
java -cp "C:\Softwares\PostgreSQL\9.3\share\pljava\deploy.jar;C:\Softwares\pgJDBC\postgresql-42.0.0.jar" org.postgresql.pljava.deploy.Deployer -install -user postgres -database sampledb -password xyz
I got this JDBC jar from the stackbuilder JDBC driver download.
I got this error while running the above command with command prompt:
org.postgresql.util.PSQLException: ERROR: could not load library "C:/Softwares/PostgreSQL/9.3/lib/pljava.dll": The specified module could not be found.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:297)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:260)
at org.postgresql.pljava.deploy.Deployer.initJavaHandlers(Deployer.java:485)
at org.postgresql.pljava.deploy.Deployer.main(Deployer.java:275)
Also my Path variable is :
C:\Windows\System32\WindowsPowerShell;C:\Windows;C:\Windows\System32\wbem;C:\Softwares\PostgreSQL\9.3\share;C:\Softwares\PostgreSQL\9.3\lib;C:\Windows\System32;C:\Softwares\PostgreSQL\9.3\bin;C:\Program Files
Java\jdk1.8.0_121\bin;C:\Program Files\Java\jdk1.8.0_121\jre\bin; C:\Program Files\Java\jdk1.8.0_121\jre\bin\server;C:\Program Files\Intel\iCLS Client;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files
Internet Explorer;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Program Files\Java\jdk1.8.0_121\jre\bin; C:\Program Files\Java\jdk1.8.0_121\jre\bin\server; C:\Program Files\Java\jdk1.8.0_121; C:\Program Files\Jav
\jdk1.8.0_121\jre
I have used dependency walker and it reports for the following files missing:
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
I have tried to do everything possible but not able to resolve it. However I noticed that Windows uses backslash '\' as Path separator while in the error message the path it is trying to search for, uses forward slash '/' .
Could this be the issue? Can Anyone help me in resolving this?
After struggling for a while, finally it worked with following fix:
I added my pljava.dll path to my PATH variable i.e.
C:\Softwares\PostgreSQL\9.3\share in PATH variable.
Also, I modified and added the following variable in my postgresql.conf:
dynamic_library_path='C:\Softwares\PostgreSQL\9.3\share\pljava'
After that my sqlj schema was populated normally.