Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDtVu-0006M1-N4 for pgsql-admin@arkaria.postgresql.org; Tue, 09 Apr 2019 16:22:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDtVt-0000bp-Fi for pgsql-admin@arkaria.postgresql.org; Tue, 09 Apr 2019 16:22:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDtVt-0000ZM-1M for pgsql-admin@lists.postgresql.org; Tue, 09 Apr 2019 16:22:21 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDtVm-0007pv-Ar for pgsql-admin@lists.postgresql.org; Tue, 09 Apr 2019 16:22:19 +0000 Received: by mail-wm1-x341.google.com with SMTP id q16so4295996wmj.3 for ; Tue, 09 Apr 2019 09:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:in-reply-to:references:mime-version; bh=OsWmZkP3+VByiSDosJ5KqRGiKYtzEncEnRVlStVup90=; b=kkgedoEsNFXZUDjR2WUuaa2+DZ72/O7w8FfFYVUF8bGUvglQhDwh68JjqZEIrRpnKK aYoZwpWErvKnqU273M3CYGt3wMIi9uTUQMEfNdMkpJD8MHuvUlEHpxoRZ8QntCybmR0y urrjqL3oQeU47n3l6KVYSfTqfr8YuzaGpv8g0w8+8LoJx5dYrgnPQ3eD7cEKe9mi+o2j RT5dcl9c7ICGcwIPweQwVYOpluTIeDaG6hnUwtkPfbkWMLbhoBR8bND5DP8InwznwmB0 u9cjN41Z0FirqYENCA+Vu+I9/+T2qQdWcSX3/VdUrlHAl2fF8W1ZDnbSEd5OK7htk0Pw ey4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version; bh=OsWmZkP3+VByiSDosJ5KqRGiKYtzEncEnRVlStVup90=; b=bG3PdW1sHPEniK1fvGq8jU+yFJaSrE3SwzizSjqRnigF3zFc58m7/pI1H6+H9fOegj L2Zhjj9qN0qGssvj+t1oElMaG0CLTiF/XWtXI+w5zYq6o14+Ne9CWeE6kotapSA1a9b7 giCw4vHy5OuJLgDF9cNT3bnGD7KONsgeDT2NnXUQwNowxo9TzO3s6qo4BqnvVbhrPnKX vdy8UDiz5bA49pzpy1DCzZhINU4uD5o2kHTcPEaj9tNERDBM3qGCQ8CQsXWicCHJeq3b 12oguBls8OxzW9q2jampfFPmZ9GEdEYu0ENjZY8Zk6wCd0yjTmSs8AqOlsFP59op+iMQ q+sw== X-Gm-Message-State: APjAAAXDShT8gpWy6+WnSqB28LEr51WS7mEYnAHKcra0SKNJWwXxJIic xbTXSTFj/GNyt3x8fJ6axDc2RhPahbk= X-Google-Smtp-Source: APXvYqxjtC92+tiSkYyEAqe236OQKJ0JlYQ3At3hvfi16/khcpgV81xH+gVTpTUsrig76nb4IhVdGg== X-Received: by 2002:a1c:2394:: with SMTP id j142mr23109705wmj.111.1554826932570; Tue, 09 Apr 2019 09:22:12 -0700 (PDT) Received: from frodriguez-HP-Notebook ([189.208.128.209]) by smtp.googlemail.com with ESMTPSA id m17sm24163264wrx.3.2019.04.09.09.22.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 09:22:12 -0700 (PDT) Message-ID: Subject: Re: How to insert from linux to postgreSQL From: Frank Alberto Rodriguez To: pgsql-admin@lists.postgresql.org Date: Tue, 09 Apr 2019 11:22:09 -0500 In-Reply-To: <4FB9BF8B-D26C-40FB-9A9C-DEB4FB016292@illinois.edu> References: <4FB9BF8B-D26C-40FB-9A9C-DEB4FB016292@illinois.edu> Content-Type: multipart/alternative; boundary="=-CtOsv1yIDduWmg7Mm0yD" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-CtOsv1yIDduWmg7Mm0yD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Then why not using java? Just exec the .jar with the terminal params and do de job in java, or read a configuration file.Or you could use PL/java. https://tada.github.io/pljava/  Greetings  On Mon, 2019-04-08 at 19:03 +0000, Campbell, Lance wrote: > PostgreSQL 10.x > > Use case: > I want to read a log file on my linux server and write each line out > to a row in a postgreSQL table. When I do inserts however I want to > make sure I am using prepared statements to avoid SQL injections. > I know how to do this is Java but I have not found an example using > a linux bash scripts. > > > Does anyone have an example they could point me to? > > Thanks, > > Lance > > > > --=-CtOsv1yIDduWmg7Mm0yD Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Then wh= y not using java? Just exec the .jar with the terminal params and do de job= in java, or read a configuration file.
Or you could use PL/java.=

Greetings
<= br>

On Mon, 2019-04-08 at 19:03 +0000, Campbell, L= ance wrote:

PostgreSQL 10.x

 

Use case:

I want to read a lo= g file on my linux server and write each line out to a row in a postgreSQL = table.  When I do inserts however I want to make sure I am using prepa= red statements to avoid SQL injections.  I know how to do this is Java but I have not found an example using a linu= x bash scripts. 

 

Does anyone have an= example they could point me to?

 

Thanks,<= /span>

&n= bsp;

Lance

 

--=-CtOsv1yIDduWmg7Mm0yD--