Re: VMS x86-64 database server

Liste des GroupesRevenir à co vms 
Sujet : Re: VMS x86-64 database server
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 08. Jul 2025, 14:35:16
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <686d1e94$0$694$14726298@news.sunsite.dk>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
On 7/8/2025 4:14 AM, Louis Krupp wrote:
On 7/7/2025 4:07 PM, Lawrence D'Oliveiro wrote:
On Mon, 7 Jul 2025 14:07:31 -0400, Arne Vajhøj wrote:
Embedded SQL is a thing or was a thing 30-40-50 years ago.
>
Basically you write source code with SQL statements prefixed by EXEC
SQL, put it through a pre-compiler to get valid code in whatever
language (Cobol, PL/I, C or whatever).
OK, so it was a horrible nonstandard hack invented for programming
languages like COBOL, which didn’t have the best ability to deal with
dynamic strings, to make it easier for them to compose SQL statements.
>
And the horribleness of it is reinforced by your statement that you need
server-side cursors in the DBMS to make this hack a little less difficult
to work with.
>
Not sure why it would be needed for PL/I, or even C.

As for embedded SQL being nonstandard, I think you might be interested in this page:
 https://www.iso.org/standard/84805.html
 which contains this line:
     ISO/IEC 9075-2 specifies embedded SQL for the programming languages:
    Ada, C, COBOL, Fortran, MUMPS, Pascal, and PL/I.
Note that while -2 covers native languages, then -10 cover
Java.
I am surprised that they still maintain embedded SQL for Java.
SQLJ has been out of fashion for like 25 years.
It can still be made to work though. Also on VMS.
Demo with SQLite:
$ type Test.sqlj
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
#sql context ConCtx;
public class Test  {
     private String constr;
     private String usr;
     private String pwd;
     private ConCtx getContext() throws SQLException {
         return new ConCtx(DriverManager.getConnection(constr, usr, pwd));
     }
     public Test(String constr, String usr, String pwd) {
         this.constr = constr;
         this.usr = usr;
         this.pwd = pwd;
     }
     #sql private static iterator T1Iterator(int, String);
     public T1 getOne(int f1) throws SQLException {
         T1 res;
         ConCtx ctx = getContext();
         T1Iterator it;
         #sql [ctx] it = { SELECT f1,f2 FROM t1 WHERE f1 = :f1};
         int xf1 = 0;
         String xf2 = null;
         #sql { fetch :it INTO :xf1, :xf2 };
         if(!it.endFetch()) {
             res = new T1(xf1, xf2);
         } else {
             res = null;
         }
         ctx.close();
         return res;
     }
     public List<T1> getAll() throws SQLException {
         List<T1> res = new ArrayList<T1>();
         ConCtx ctx = getContext();
         T1Iterator it;
         #sql [ctx] it = { SELECT f1,f2 FROM t1 };
         while(true) {
             int xf1 = 0;
             String xf2 = null;
             #sql { fetch :it INTO :xf1, :xf2 };
             if(it.endFetch()) break;
             res.add(new T1(xf1, xf2));
         }
         ctx.close();
         return res;
     }
     public void save(T1 o) throws SQLException {
         ConCtx ctx = getContext();
         int f1 = o.getF1();
         String f2 = o.getF2();
         #sql [ctx] { INSERT INTO t1 VALUES(:f1,:f2) };
         ctx.close();
     }
     public void remove(int f1) throws SQLException {
         ConCtx ctx = getContext();
         #sql [ctx] { DELETE FROM t1 WHERE f1 = :f1 };
         ctx.close();
     }
}
$ type T1.java
public class T1 {
     private int f1;
     private String f2;
     public T1() {
         this(0, "");
     }
     public T1(int f1, String f2) {
         this.f1 = f1;
         this.f2 = f2;
     }
     public int getF1() {
         return f1;
     }
     public void setF1(int f1) {
         this.f1 = f1;
     }
     public String getF2() {
         return f2;
     }
     public void setF2(String f2) {
         this.f2 = f2;
     }
     public String toString() {
         return String.format("[%d,%s]", f1, f2);
     }
}
$ java -cp translator.jar:runtime12.jar:ojdbc5.jar:sunio.jar:sqlite-jdbc-3_47_2_0.jar "sqlj.tools.Sqlj" -codegen=iso -compile=false -driver="org.sqlite.JDBC" -url="jdbc:sqlite:test.db" -user="" -password="" "Test.sqlj"
$ javac -cp runtime12.jar Main.java Test.java T1.java
$ java "-Xmx512m" -cp .:translator.jar:runtime12.jar:ojdbc5.jar:sunio.jar:sqlite-jdbc-3_47_2_0.jar "Main" "org.sqlite.JDBC" "jdbc:sqlite:test.db" "" ""
[2,BB]
[1,A]
[2,BB]
[3,CCC]
[1,A]
[2,BB]
[3,CCC]
[999,XXX]
[1,A]
[2,BB]
[3,CCC]
runtime12.jar and translator.jar is Oracle SQLJ implementation
from many years ago. They can be found in an older Oracle DB
or Oracle DB client kit.
ojdbc5.jar is a standard Oracle JDBC driver for Java 5. Oracle
SQLJ supports other databases than Oracle DB, but still require
Oracle DB JDBC driver.
sunio.jar is the sun.io package from a Java 5/6/7. That package
is unsupported, not supposed to be used and removed in Java 8.
But SQLJ uses it. So one has to borrow those classes from an
older Java.
Arne

Date Sujet#  Auteur
6 Jul20:45 * VMS x86-64 database server87Arne Vajhøj
6 Jul22:39 +- Re: VMS x86-64 database server1Lawrence D'Oliveiro
6 Jul23:07 +* Re: VMS x86-64 database server54Arne Vajhøj
7 Jul00:19 i+* Re: VMS x86-64 database server52Lawrence D'Oliveiro
7 Jul00:58 ii`* Re: VMS x86-64 database server51Arne Vajhøj
7 Jul03:42 ii `* Re: VMS x86-64 database server50Lawrence D'Oliveiro
7 Jul19:07 ii  `* Re: VMS x86-64 database server49Arne Vajhøj
7 Jul19:16 ii   +* Re: VMS x86-64 database server2Arne Vajhøj
7 Jul19:21 ii   i`- Re: VMS x86-64 database server1Arne Vajhøj
7 Jul23:07 ii   `* Re: VMS x86-64 database server46Lawrence D'Oliveiro
8 Jul00:28 ii    +* Re: VMS x86-64 database server24Arne Vajhøj
8 Jul01:26 ii    i`* Re: VMS x86-64 database server23Lawrence D'Oliveiro
8 Jul13:45 ii    i `* Re: VMS x86-64 database server22Arne Vajhøj
8 Jul22:57 ii    i  `* Re: VMS x86-64 database server21Lawrence D'Oliveiro
8 Jul23:40 ii    i   `* Re: VMS x86-64 database server20Arne Vajhøj
9 Jul00:38 ii    i    `* Re: VMS x86-64 database server19Lawrence D'Oliveiro
9 Jul02:54 ii    i     `* Re: VMS x86-64 database server18Arne Vajhøj
9 Jul08:25 ii    i      `* Re: VMS x86-64 database server17Lawrence D'Oliveiro
9 Jul20:33 ii    i       `* Re: VMS x86-64 database server16Arne Vajhøj
10 Jul00:07 ii    i        `* Re: VMS x86-64 database server15Lawrence D'Oliveiro
10 Jul00:51 ii    i         `* Re: VMS x86-64 database server14Arne Vajhøj
10 Jul02:21 ii    i          `* Re: VMS x86-64 database server13Lawrence D'Oliveiro
10 Jul03:24 ii    i           `* Re: VMS x86-64 database server12Arne Vajhøj
10 Jul05:28 ii    i            +* Re: VMS x86-64 database server9Lawrence D'Oliveiro
11 Jul00:05 ii    i            i`* Re: VMS x86-64 database server8Arne Vajhøj
11 Jul00:58 ii    i            i `* Re: VMS x86-64 database server7Lawrence D'Oliveiro
11 Jul01:11 ii    i            i  `* Re: VMS x86-64 database server6Arne Vajhøj
11 Jul01:19 ii    i            i   `* Re: VMS x86-64 database server5Lawrence D'Oliveiro
11 Jul01:23 ii    i            i    `* Re: VMS x86-64 database server4Arne Vajhøj
11 Jul01:29 ii    i            i     `* Re: VMS x86-64 database server3Lawrence D'Oliveiro
11 Jul01:38 ii    i            i      `* Re: VMS x86-64 database server2Arne Vajhøj
11 Jul03:54 ii    i            i       `- Re: VMS x86-64 database server1Lawrence D'Oliveiro
11 Jul00:57 ii    i            `* Re: VMS x86-64 database server2Arne Vajhøj
11 Jul01:24 ii    i             `- Re: VMS x86-64 database server1Lawrence D'Oliveiro
8 Jul14:35 ii    `* Re: VMS x86-64 database server21Arne Vajhøj
8 Jul22:56 ii     `* Re: VMS x86-64 database server20Lawrence D'Oliveiro
8 Jul23:20 ii      `* Re: VMS x86-64 database server19Arne Vajhøj
9 Jul00:37 ii       `* Re: VMS x86-64 database server18Lawrence D'Oliveiro
9 Jul01:31 ii        `* Re: VMS x86-64 database server17Arne Vajhøj
9 Jul08:22 ii         `* Re: VMS x86-64 database server16Lawrence D'Oliveiro
10 Jul01:04 ii          `* Re: VMS x86-64 database server15Arne Vajhøj
10 Jul01:25 ii           +* Re: VMS x86-64 database server12Arne Vajhøj
10 Jul02:35 ii           i`* Re: VMS x86-64 database server11Lawrence D'Oliveiro
10 Jul03:26 ii           i `* Re: VMS x86-64 database server10Arne Vajhøj
10 Jul06:48 ii           i  `* Re: VMS x86-64 database server9Lawrence D'Oliveiro
11 Jul00:14 ii           i   `* Re: VMS x86-64 database server8Arne Vajhøj
11 Jul00:54 ii           i    `* Re: VMS x86-64 database server7Lawrence D'Oliveiro
11 Jul01:29 ii           i     `* Re: VMS x86-64 database server6Arne Vajhøj
12 Jul00:35 ii           i      `* Re: VMS x86-64 database server5Lawrence D'Oliveiro
12 Jul00:43 ii           i       `* Re: VMS x86-64 database server4Arne Vajhøj
12 Jul01:35 ii           i        `* Re: VMS x86-64 database server3Lawrence D'Oliveiro
12 Jul01:48 ii           i         `* Re: VMS x86-64 database server2Arne Vajhøj
12 Jul03:01 ii           i          `- Re: VMS x86-64 database server1Lawrence D'Oliveiro
10 Jul02:33 ii           `* Re: VMS x86-64 database server2Lawrence D'Oliveiro
11 Jul01:33 ii            `- Re: VMS x86-64 database server1Lawrence D'Oliveiro
11 Jul00:50 i`- Re: VMS x86-64 database server1Arne Vajhøj
6 Jul23:11 +- Re: VMS x86-64 database server1Arne Vajhøj
6 Jul23:39 `* Re: VMS x86-64 database server30Craig A. Berry
7 Jul00:57  `* Re: VMS x86-64 database server29Arne Vajhøj
7 Jul15:50   `* Re: VMS x86-64 database server28Mark Berryman
7 Jul19:01    `* Re: VMS x86-64 database server27Arne Vajhøj
7 Jul22:06     `* Re: VMS x86-64 database server26Mark Berryman
7 Jul22:36      +* Re: VMS x86-64 database server2Arne Vajhøj
7 Jul22:37      i`- Re: VMS x86-64 database server1Arne Vajhøj
7 Jul23:08      `* Re: VMS x86-64 database server23Lawrence D'Oliveiro
8 Jul00:21       `* Re: VMS x86-64 database server22Arne Vajhøj
8 Jul01:27        `* Re: VMS x86-64 database server21Lawrence D'Oliveiro
8 Jul12:14         `* Re: VMS x86-64 database server20Arne Vajhøj
8 Jul22:58          `* Re: VMS x86-64 database server19Lawrence D'Oliveiro
8 Jul23:14           +* Re: VMS x86-64 database server14Arne Vajhøj
9 Jul00:40           i`* Re: VMS x86-64 database server13Lawrence D'Oliveiro
9 Jul03:18           i `* Re: VMS x86-64 database server12Arne Vajhøj
9 Jul08:27           i  +- Re: VMS x86-64 database server1Lawrence D'Oliveiro
9 Jul11:16           i  `* Re: VMS x86-64 database server10hb0815
9 Jul15:13           i   `* Re: VMS x86-64 database server9Arne Vajhøj
9 Jul17:51           i    `* Re: VMS x86-64 database server8hb0815
9 Jul18:39           i     `* Re: VMS x86-64 database server7Arne Vajhøj
9 Jul18:56           i      +- Re: VMS x86-64 database server1Chris Townley
9 Jul20:55           i      `* Re: VMS x86-64 database server5hb0815
10 Jul20:50           i       `* Re: VMS x86-64 database server4Arne Vajhøj
10 Jul20:52           i        `* Re: VMS x86-64 database server3Arne Vajhøj
11 Jul12:09           i         `* Re: VMS x86-64 database server2hb0815
11 Jul15:16           i          `- Re: VMS x86-64 database server1Arne Vajhøj
10 Jul01:12           `* Re: VMS x86-64 database server4bill
10 Jul13:00            `* Re: VMS x86-64 database server3Dan Cross
11 Jul00:23             +- Re: VMS x86-64 database server1Arne Vajhøj
11 Jul23:13             `- Re: VMS x86-64 database server1Stephen Hoffman

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal