Re: Not able to connect to postgresql database
От | Maciek Sakrejda |
---|---|
Тема | Re: Not able to connect to postgresql database |
Дата | |
Msg-id | AANLkTinhQuFqfz3Uc27-kSDFAPsvkjXmI-EA3Q_BLCKf@mail.gmail.com обсуждение исходный текст |
Ответ на | Not able to connect to postgresql database (Manohar Bhattarai <manoharbhattarai@gmail.com>) |
Список | pgsql-jdbc |
Well, first of all, you may want to stick with a single driver jar. 8.4 is backwards compatible with 8.3, so you should probably use 8.4, and jdbc3 vs. jdbc4 is a Java version issue--jdbc4 for Java 6 and up, jdbc3g for Java 5. I'm not sure what happens if you try to load different definitions of the same class four times (not to mention that I'm not sure how it's even possible, since the 3g and 4 versions are compile-time incompatible with projects using a different Java version). If you're still getting errors, try an explicit Class.forName("org.postgresql.Driver"); and see if you still get an Exception. If so, it sounds like an Eclipse configuration issue since the jar isn't showing up in your classpath. --- Maciek Sakrejda | System Architect | Truviso 1065 E. Hillsdale Blvd., Suite 230 Foster City, CA 94404 (650) 242-3500 Main (650) 242-3501 F www.truviso.com On Tue, Jun 1, 2010 at 1:19 PM, Manohar Bhattarai <manoharbhattarai@gmail.com> wrote: > Hi, > I am a newbie for postgresql. I am trying to connect to postgresql database > using jdbc. I googled about it and got the Driver string and connection > string formats. I tried using some examples i got on the internet. But my > program is not able to connect to postgresql and shows an exception that it > cannot find driver. I am doing it in Ubuntu8.04 Linux with Postgresql 8.3 > installed. I am using Eclipse galileo as IDE. I created database using > commands in terminal. I have added the external jar files for postgresql > jdbc connector(postgresql-8.3-603.jdbc3.jar, postgresql-8.3-603.jdbc4.jar, > postgresql-8.4-701.jdbc3.jar and postgresql-8.4-701.jdbc4.jar) in my project > also. > Please help me and let me know what i am doing wrong and what i am missing. > Can you please give an example code if possible? > Thanks > -- > Regards, > Manohar Bhattarai (मनोहर भट्टराई) > Blogs: > http://manoharbhattarai.wordpress.com/ > http://manoharbhattarai.posterous.com/ > http://manoharbhattarai.blogspot.com/ > Microblogs: > Twitter :- http://twitter.com/manoharmailme > Identi.ca :- http://identi.ca/manoharbhattarai >
В списке pgsql-jdbc по дате отправления: