Sujet : VMS x86-64 database server
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 06. Jul 2025, 20:45:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <104ejo8$2cobv$1@dont-email.me>
User-Agent : Mozilla Thunderbird
As we all know then the available options are currently very limited.
But I just found a little trick to get one more.
:-)
$ write sys$output f$getsyi("VERSION")
V9.2-3
$ type TestPG.java
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
public class TestPG {
public static void main(String[] args) throws Exception {
Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5435/test", "sa", "hemmeligt");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT f1,f2 FROM t1");
while(rs.next()) {
int f1 = rs.getInt(1);
String f2 = rs.getString(2);
System.out.println(f1 + " " + f2);
}
rs.close();
stmt.close();
con.close();
}
}
$ javac TestPG.java
$ java -cp .:/javalib/postgresql-42_5_1.jar TestPG
1 A
2 BB
3 CCC
$ type test.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <libpq-fe.h>
int main()
{
PGconn *con = PQconnectdb("host=localhost port=5435 dbname=test user=sa password=hemmeligt");
PGresult *res;
res = PQprepare(con, "stmt_selectf1f2fromt1", "SELECT f1,f2 FROM t1", 0, NULL);
PQclear(res);
res = PQexecPrepared(con, "stmt_selectf1f2fromt1", 0, NULL, NULL, NULL, 0);
int nrows = PQntuples(res);
for(int i = 0; i < nrows; i++)
{
int f1 = atoi(PQgetvalue(res, i, 0));
char f2[51];
strcpy(f2, PQgetvalue(res, i, 1));
printf("%d %s\n", f1, f2);
}
PQclear(res);
PQexec(con, "DEALLOCATE stmt_selectf1f2fromt1");
PQfinish(con);
return 0;
}
$ cc /include=libpq$root:[include] /name=as_is test
$ link test + libpq$root:[lib]libpq/libr + libpq$root:[lib]libgpgtypes/libr + ssl111$lib:ssl111$libssl/libr + ssl111$lib:ssl111$libcrypto/libr
$ run test
1 A
2 BB
3 CCC
C:\IDEProjects\EclipsePHP\Test>type TestPDO.php
<?php
$con = new PDO('pgsql:host=arne4;port=5435;dbname=test', 'sa', 'hemmeligt');
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$con->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$stmt = $con->prepare('SELECT f1,f2 FROM t1');
$stmt->execute(array());
while($row = $stmt->fetch()) {
$f1 = $row['f1'];
$f2 = $row['f2'];
echo "$f1 $f2\r\n";
}
?>
C:\IDEProjects\EclipsePHP\Test>php TestPDO.php
1 A
2 BB
3 CCC
I cannot use PHP on VMS yet as I don't have a PHP with pgsql and
pdo_pgsql. But given that libpq is ported, then those can probably
be build.
So what is happening here?
PostgreSQL on VMS x86-64????
No. Sorry.
I am using a little trick. H2 can emulate both PostgreSQL
SQL dialect and PostgreSQL network protocol.
$ type server.com
$ java -cp /javalib/h2-2_2_220.jar "org.h2.tools.Server" -tcp "-tcpAllowOthers" -pg "-pgAllowOthers" -baseDir .
$ exit
$ @server
TCP server running at tcp://192.168.68.40:9092 (others can connect)
PG server running at pg://192.168.68.40:5435 (others can connect)
:-)
Arne