NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Canuck
Joined: 30 Dec 2009 Posts: 25
|
Posted: Thu Feb 10, 2011 10:13 pm Post subject: loading jar fies |
|
|
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
|
Posted: Fri Feb 11, 2011 6:01 am Post subject: Re: loading jar fies |
|
|
| 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
|
Posted: Fri Feb 11, 2011 4:50 pm Post subject: loading jar fies |
|
|
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
|
Posted: Fri Feb 11, 2011 6:19 pm Post subject: loading jar fies |
|
|
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
|
Posted: Fri Feb 11, 2011 8:43 pm Post subject: Re: loading jar fies |
|
|
| 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
|
Posted: Sat Feb 12, 2011 6:03 pm Post subject: loading jar fies |
|
|
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 |
|
 |
|
|
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
|
|