Connect to postgresql database via MATLAB error - database

I am trying to connect my Postgres database in MATLAB and it is throwing me an error stating
"'JDBC Driver Error: org.postgresql.Driver. Driver Not Found/Loaded.'"
Here's my connection method that i have used.
conn = database('postgres','username','password','org.postgresql.Driver', 'jdbc:postgresql://localhost:5432/postgres=postgres');
after that it throws me the error.
I have looked at forums and they told me to add the postgres jar files to the MATLAB directory toolkit textfile, such as below.
C:\Program Files\PostgreSQL\pgJDBC\postgresql-8.4.702.jdbc3.jar
C:\Program Files\PostgreSQL\pgJDBC\postgresql-8.4.702.jdbc4.jar
I don't know where else I am going wrong. Please advise.
Thank you.

You should add jar file with JDBC driver to your dynamic java class path before connecting to database. I believe you can add only one file depending on your requirements. Check the versions difference here.
To avoid warning if a jar file already in the path add some check:
%# add class path (if not in the class path)
p = 'C:\Program Files\PostgreSQL\pgJDBC\postgresql-8.4.702.jdbc3.jar';
if ~ismember(p,javaclasspath)
javaaddpath(p)
end

Related

Connecting oracle data base from C program using pro*c

I want to try execute SQL statement from a C program using pro*c.
I have tried installing oracle Database from
https://www.oracle.com/database/technologies/oracle19c-windows-downloads.html
It consist of zipped file.
I just extracted the zip file into my C:/oracle directory.
The directory already consist of precompile folder.
I set path variable to C:/oracle/bin/ .
For checking installation of proc compiler, I ran "proc" command, but it produces the following error.
C:\PJT>proc
PCC-F-NOERRFILE, unable to open error message file, facility PR2
Am I doing something wrong?
Any help is highly appreciated.

Jenkins: File not found exception

I am trying to load a file from a repository I checked out. I am getting this error:
new File( iFilePath )
Err: Build failed with Error: java.io.FileNotFoundException: Y:\Jenkins\workspace\TestBuilds\Matlab\m\Contents.m (The system cannot find the path specified)
This is explained because Jenkins try to look for the file on the master. While the file is actually located on the slave agent.
Any way to get around this ?
Check out this answer: https://stackoverflow.com/a/42018578/3486967
I don't think you can use the File class on anything but the Jenkins master; try using the FilePath class

Runtime error Exception has been thrown by the target of an invocation” from Script task

While running the script task an message box with runtime exception came and package is aborted.
I tried to debug the script by using msgbox in vb and it worked fine upto some point and after that it thrown the exception.
Dim SSHClient As New SSHClient()
My code uses SSH.client connection which is used to access sftp file share.I am importing the DLL
Imports Xceed.SSH.Client
Everytime I run the same exception is coming..need some help In this.
I think the exception is thrown because the reference is not found at runtime, you have to assign this reference to the Global Cache assembly using GACUTIL or just copy the DLL file to the following directories:
(1) .Net Framework dll directory
C:\Windows\Microsoft.NET\Framework\v[.net installed version]\
example
C:\Windows\Microsoft.NET\Framework\v4.0.30319\
(2) SQL server data tools dll runtime directory
C:\Program Files (x86)\Microsoft SQL Server\[SQL Server version]\DTS\Binn
example
C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn

Orafce install in postgresql 9.5

I am new to programmer world so i want to learn so many things, and about what i want to ask, can i install orafce in postgresql? I mean all the tutorial always show use BigSql but iam using from enterprise DB. I am already try take orafce.dll from bigsql but it can't read because not specified procedure.
ERROR: could not load library "C:/Program Files/PostgreSQL/9.5/lib/orafce.dll": The specified procedure could not be found.
and i already try from other source but still got some error
ERROR: could not find function "plvlex_tokens" in file "C:/Program Files/PostgreSQL/9.5/lib/orafce.dll"
It was a bug in Orafce windows build. Should be fixed by last build.

ClassNotFoundException with Netbeans and H2 Database

So I followed the tutorial on the H2 Documentation page and used the "Connecting to a Database using JDBC" method of connecting to the database. I First added the h2-*.jar file to the Lib Folder (through Netbeans) and used the following to make the connection to my database I previously created.
Class.forName("org.h2.Driver");
connection = DriverManager.getConnection("jdbc:h2:~/" + DatabaseName);
This turned out to work in the IDE environment, however when I attempted to run the application directly from the jar executable I get the following error:
java.lang.ClassNotFoundException: org.h2.Driver ...
this error occurs at the Class.forName() class loader. So I did a little looking around and found that this was a prominent problem. One solution people use was to extract the class Loader from the current Thread as so:
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
cl.getClass().getClassLoader();
Class toRun = cl.loadClass("org.h2.Driver");
Unfortunately this seems to still result in the same error, so i'm wondering what i'm doing wrong. Should I be doing something to make sure the Driver is in the class path? I have no I idea how if that's the case.
Thanks!
You need to add the h2-*.jar file to the classpath when running the application, for example using
java -cp h2*.jar -jar yourApp.jar

Resources