NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

loading jar fies

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Canuck



Joined: 30 Dec 2009
Posts: 25

PostPosted: Thu Feb 10, 2011 10:13 pm    Post subject: loading jar fies Reply with quote

Hello
In this case, I cannot get

Class.forName ("org.postgresql.Driver");

to work.

I have used customize...> Libraries to access
postgresql-9.0-801.jdbc4.jar.
the test program chokes with a

java.lang.ClassNotFoundException: org.postgresql.Driver

error. I have looked and postgresql-9.0-801.jdbc4.jar does indeed have
a "org.postgresql.Driver" member.

How can I have messed up such a simple thing??

Thank you for your time.

dkr
Back to top
areeda



Joined: 28 Aug 2008
Posts: 469
Location: Los Angeles

PostPosted: Fri Feb 11, 2011 6:01 am    Post subject: Re: loading jar fies Reply with quote

Canuck wrote:


I have used customize...> Libraries to access
postgresql-9.0-801.jdbc4.jar.

I think you want to right click on the project, go to the libraries and add postgress there.

Joe
Back to top
Canuck



Joined: 30 Dec 2009
Posts: 25

PostPosted: Fri Feb 11, 2011 4:50 pm    Post subject: loading jar fies Reply with quote

On 11-02-10 11:01 PM, areeda wrote:
Quote:
Canuck wrote:
Quote:

I have used customize...> Libraries to access
postgresql-9.0-801.jdbc4.jar.

Quote:
Quote:
I think you want to right click on the project, go to the libraries and add postgress there.

Joe
Thank you for your time. Yes I clicked on the project & post*jar is
already there; but it
stilI refuses to cooperate! I think it hates me!

dkr
Back to top
Canuck



Joined: 30 Dec 2009
Posts: 25

PostPosted: Fri Feb 11, 2011 6:19 pm    Post subject: loading jar fies Reply with quote

On 11-02-11 09:48 AM, Doug Robinson wrote:
Quote:
On 11-02-10 11:01 PM, areeda wrote:
Quote:
Canuck wrote:
Quote:

I have used customize...> Libraries to access
postgresql-9.0-801.jdbc4.jar.

Quote:
Quote:
I think you want to right click on the project, go to the libraries
and add postgress there.

Joe
Thank you for your time. Yes I clicked on the project & post*jar is
already there; but it
stilI refuses to cooperate! I think it hates me!

dkr



I forgot to mention that I have installed NetBeans 7.0BETA
Back to top
areeda



Joined: 28 Aug 2008
Posts: 469
Location: Los Angeles

PostPosted: Fri Feb 11, 2011 8:43 pm    Post subject: Re: loading jar fies Reply with quote

Canuck wrote:
]I forgot to mention that I have installed NetBeans 7.0BETA

I just ran a test on 7.0B2 so it might be a little different.

Code:
    public static void main(String[] args) throws SQLException
    {
        try
        {
            Class.forName("org.postgresql.Driver");

            String connUrl = "dbc:postgresql:://localhost/" + "test";
            Connection connection = DriverManager.getConnection(connUrl, "test", "pass");
            Statement statement = connection.createStatement();
        }
        catch (ClassNotFoundException ex)
        {
            Logger.getLogger(PostgresqlTest.class.getName()).log(Level.SEVERE, null, ex);
        }

Works fine. I used the library included with NetBeans not the postgres jar file I'm not familiar with the one you are using but I'm more of a mysql guy with minimal pg experience.

the library name I used is called PostgreSQL JDBC Driver
You might be getting a lower level without the JDBC hooks.

Joe
Back to top
Canuck



Joined: 30 Dec 2009
Posts: 25

PostPosted: Sat Feb 12, 2011 6:03 pm    Post subject: loading jar fies Reply with quote

On 11-02-11 01:44 PM, areeda wrote:
Quote:
Canuck wrote:
Quote:
]I forgot to mention that I have installed NetBeans 7.0BETA
I just ran a test on 7.0B2 so it might be a little different.


Code:
public static void main(String[] args) throws SQLException
{
try
{
Class.forName("org.postgresql.Driver");

String connUrl = "dbc:postgresql:://localhost/" + "test";
Connection connection = DriverManager.getConnection(connUrl, "test", "pass");
Statement statement = connection.createStatement();
}
catch (ClassNotFoundException ex)
{
Logger.getLogger(PostgresqlTest.class.getName()).log(Level.SEVERE, null, ex);
}



Works fine. I used the library included with NetBeans not the postgres jar file I'm not familiar with the one you are using but I'm more of a mysql guy with minimal pg experience.

the library name I used is called PostgreSQL JDBC Driver
You might be getting a lower level without the JDBC hooks.

Joe





OK got it - unfortunately I cannot blame Netbeans for my
failure to add post*.jar to the correct project.
Duh!
Thanks again
dkr
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo