Re: Right version of jdbc

From: Raivo Rebane <raivore55(at)gmail(dot)com>
To: Dave Cramer <davecramer(at)postgres(dot)rocks>
Cc: Ron <ronljohnsonjr(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Right version of jdbc
Date: 2023-09-29 13:03:26
Message-ID: CAMH5fpvTy1hw_T14CGNFQHqKqApWif4_O4s69utG8bkZh_3kKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I removed this recommended jar.
I am using Eclipse and there Java 1.8 is setted.
What I have to do ?

Raivo

On Fri, Sep 29, 2023 at 2:05 PM Dave Cramer <davecramer(at)postgres(dot)rocks>
wrote:

>
> Dave Cramer
> www.postgres.rocks
>
>
> On Fri, 29 Sept 2023 at 06:19, Raivo Rebane <raivore55(at)gmail(dot)com> wrote:
>
>> Hi,
>>
>> The code is :
>> package MushroomAPIs;
>>
>> import java.io.IOException;
>> import javax.servlet.ServletException;
>> import javax.servlet.annotation.WebServlet;
>> import javax.servlet.http.HttpServlet;
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>
>> import java.sql.Connection;
>> import java.sql.DriverManager;
>> import java.sql.PreparedStatement;
>> import java.sql.ResultSet;
>> import java.sql.SQLException;
>> import java.sql.Timestamp;
>>
>> @WebServlet("/AddMushrooms")
>> public class AddMushrooms extends HttpServlet implements
>> java.io.Serializable {
>> protected void doGet(HttpServletRequest request, HttpServletResponse
>> response)
>> throws ServletException, IOException {
>>
>> final String DB_URL =
>> "jdbc:postgresql://localhost:5432/mushroom_database";
>> final String USER = "mushroomer";
>> final String PASSWORD = "";
>>
>> Connection connection = null;
>> Timestamp LastModifiedTS = Timestamp.valueOf("1970-01-01 00:00:00");
>>
>> try {
>> connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
>>
>> // SQL päring vanima timestamp-i leidmiseks
>> String query = "SELECT timestamp AS oldest_timestamp FROM mushrooms";
>> PreparedStatement statement = connection.prepareStatement(query);
>> ResultSet resultSet = statement.executeQuery();
>>
>> while (resultSet.next()) {
>> Timestamp oldest_timestamp = resultSet.getTimestamp("oldest_timestamp");
>> if (oldest_timestamp.after(LastModifiedTS))
>> LastModifiedTS = oldest_timestamp;
>> }
>> System.out.println("Vanim timestamp: " + LastModifiedTS);
>>
>> } catch (SQLException e) {
>> e.printStackTrace();
>> }
>>
>> int count = ProcAddMushrooms.GetAddMushrooms(connection, LastModifiedTS);
>>
>> response.getWriter().println("Added " + count + " mushrooms");
>> }
>> }
>> and available from github - https://github.com/raaivore/APIexperiment
>>
>> May be somebody can help me to solve the problem ?
>>
>> Raivo
>>
>> On Fri, Sep 29, 2023 at 6:44 AM Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
>>
>>> On 9/28/23 01:18, Raivo Rebane wrote:
>>>
>>> [snip]
>>>
>>> I made a new Java application Eclipse Dynamic WEB application and want
>>> to use Postgres - PostgreSQL 10.14
>>>
>>> [snip]
>>>
>>> What's wrong. Or is better to use more newer postgres. And then which
>>> jdbc-I need to use ?
>>>
>>>
>>> https://www.postgresql.org/support/versioning/
>>>
>>> Pg 10 will be EOL in *6 weeks*. Thus, "yes, use a newer version of
>>> Postgresql" (unless, like me, you're constrained by circumstances like "the
>>> business won't let us upgrade").
>>>
>>> Pg 15 and the latest JDBC are in the repositories:
>>> https://www.postgresql.org/download/
>>>
>> --
>>> Born in Arizona, moved to Babylonia.
>>>
>>
>
>
> I loaded your project in IDEA and it was referring to jdk1.7
> It also looks like you still have the postgis-geometry-2.5.0.jar in the
> webapp/lib dir remove it
>
> Dave
>

Attachment Content-Type Size
image/png 55.0 KB
image/png 65.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Giovanni Biscontini 2023-09-29 15:55:17 pg_agent jobs
Previous Message Dave Cramer 2023-09-29 11:05:35 Re: Right version of jdbc