JDBC Connection : PostGreSQL + Rifidi-SDK's Example Code

The Forum for Non-Technical questions

Moderators: Matt, kyle, Moderators

Post Reply
umangsamani
Posts: 12
Joined: Fri Oct 01, 2010 6:24 am
Organization: Argusoft

JDBC Connection : PostGreSQL + Rifidi-SDK's Example Code

Post by umangsamani » Wed Nov 17, 2010 8:33 am

Dear All,

I am facing a problem in adding the dependency [jar file] of PostGreSQL. I am using the normal JDBC connection to add the data which I get after processing the tagArrived() and tagDeparted() methods.

And in order to add the data inside the database I use this simple code :-

Code: Select all

public Boolean openConnection() {
    Boolean result = true;
    try {
    Class.forName("org.postgresql.Driver");
    pgsqlConnection = DriverManager.getConnection(connString, "postgres", "");
    } catch (Exception e) {
    result = false;
    e.printStackTrace();
    }
    System.out.println("Connection Open Result :- " + result);
    return result;
}

Now I am and I should always get the error that ClassNotFound for Class.forName("org.postgresql.Driver"); as I dont know how and where to add the jar file.

My second question is, once you guide me how to add the dependency I would also like to know that when we export the bundle [plugin folder which gets generated] and we deploy it inside the Edge Server how will the jar of PostGreSQL be added. ?

Please help me out.

Thanks
umangsamani

Matt
Posts: 362
Joined: Fri May 02, 2008 11:56 am
Organization: Pramari

Re: JDBC Connection : PostGreSQL + Rifidi-SDK's Example Code

Post by Matt » Wed Nov 17, 2010 5:45 pm

The easiest way to add that is to make a folder in your project called "lib", then put the jar in it, then right click -> add to build path. Should work after that. I've connected to a Mysql database before by using Spring before as well:

http://static.springsource.org/spring/d ... /jdbc.html

so if you would like to do that there are some rather in-depth instructions there.

Post Reply

Who is online

Users browsing this forum: Marinafbq, Svetlmwu and 2 guests