pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Hernández Tortosa <aht@8kdata.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
Date: Tue, 29 Mar 2016 13:13:19 +0200
Message-ID: <56FA634F.1070209@8kdata.com> (raw)
In-Reply-To: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com>
References: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>


     IMVHO, I completely got rid of issues like this when I started 
using Maven (or Gradle or equivalent).

     I'd recommend you to do the same (and by the way, use a more modern 
version of the driver).


     Álvaro


-- 
Álvaro Hernández Tortosa


-----------
8Kdata




On 29/03/16 13:04, Nithin Chakravarthi wrote:
> Hi All,
>
> I am working on java project to insert and fetch data from postgresql 
> database. While using jbdc I am getting error
>
> "*java.lang.ClassNotFoundException: org.postgresql.Driver
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>     at java.lang.Class.forName0(Native Method)
>     at java.lang.Class.forName(Class.java:264)
>     at SqlConnection.sql_connection(SqlConnection.java:29)
>     at ServerConnection.run(ServerConnection.java:205)
>     at java.lang.Thread.run(Thread.java:745)
> "
> *
> FYI I am using multiple source files. Main function is defined in one 
> file and I am using postgresql connection in another file
>
> Here is my src
>
> *"private static final String DB_URL =
>                           "jdbc:postgresql://127.0.0.1:5432/testdb 
> <http://127.0.0.1:5432/testdb>";;
>
>         public int sql_connection(String outletid, String messageid, 
> String checkid,int msgarry,String message,PrintStream os)
>         {
>                         String []lines = message.split("\\?");
>                         String [] separated = lines[0].split("\\|");
>                                 //for(int i=0;i<4;i++)
> //System.out.println("received  msg from client :"+separated[i]);
>                         msgformation pack = new msgformation();
>                         System.out.println("sizes---: " 
> +separated.length+" ---Arry Received: "+ msgarry);
>                         if(separated.length==msgarry){
>                                 try{
> System.out.println("Connecting to database...");
>                                         Properties password = new 
> Properties();
> password.put("user","postgress");
> password.put("password","postgress");
> password.put("host","localhost");
> Class.forName("org.postgresql.Driver");
> //DriverManager.register(org.postgresql.Driver());
>                                         ServerMain.conn = 
> DriverManager.getConnection(DB_URL,password);
>
> "
> *
> I have exported class path as
>
> *"export CLASSPATH=./Server.jar:~/Downloads/postgresql-9.3-1103.jdbc3.jar"
> *
>
> Server.jar is main executable file.
>
> So please help me to solve this issue.
> Thanks & Regards,
> *M. Nithin Chakravrthi*
> Software Engineer
>
> *EmbDes Technologies Pvt Ltd*
> #124,2nd Floor,Hosur Main Road, Madiwala,| Bangalore-68 |Karnataka,**India
> Tel: 080-25537562 | Mob: +91-8050597236
>
> *Website <http://www.embdestech.co.in/; | Email 
> <mailto:nithin@embdestech.co.in> |Map 
> <https://www.google.com/maps/place/EmbDes+Technologies/@12.9198502,77.6193159,17z/data=%213m1%214b1%2...

view thread (6+ messages)  latest in thread

Message-ID: <56FA634F.1070209@8kdata.com>
Permalink:  ../56FA634F.1070209@8kdata.com/
Also on:    postgresql.org/message-id/56FA634F.1070209@8kdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: aht@8kdata.com
  Subject: Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
  In-Reply-To: <56FA634F.1070209@8kdata.com>
  References: <CAE3Q90zo6SngbxbKOVa+tvtot21ioYWd3N_YCz_S+FN9ZZC8ug@mail.gmail.com> <56FA634F.1070209@8kdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox