Discussion:
Accessing MS SQLServer from VMS in a JVM language
Add Reply
Arne Vajhøj
2024-08-27 00:44:32 UTC
Reply
Permalink
This is surprisingly easy:

1) enable SQLServer authentication (Windows authentication only will not
work)
2) download official Microsoft JDBC driver and transfer it to VMS
3) make sure TCP port 1433 is open in various firewalls

And voila - access from Java, Groovy, Kotlin, Scala and more
exotic JVM languages.

Demo with Groovy:

$ type mssql.groovy
import java.sql.*

con =
DriverManager.getConnection("jdbc:sqlserver://arnepc5;database=Test;integratedSecurity=false;encrypt=false;",
"sa", "hemmeligt
")
pstmt = con.prepareStatement("SELECT f1, f2 FROM t1")
rs = pstmt.executeQuery()
while(rs.next()) {
f1 = rs.getInt(1)
f2 = rs.getString(2)
printf("%d %s\n", f1, f2)
}
con.close()
$ groovy_cp = "mssql-jdbc-12_2_0_jre8.jar"
$ groovy mssql.groovy
1 A
2 BB
3 CCC

And if JDBC is too low level then JPA can be used (Hibernate
works fine as JPA provider on VMS - and it does come with
SQLServer dialect).

Easy.

One of the finer points is that the Microsoft JDBC driver
is type 4 for SQLServer authentication and therefore can run
on VMS (it is type 2 for Windows autehntication, but that does
not matter).

So no need for jTDS JDBC driver.

Arne
Craig A. Berry
2024-08-27 01:17:20 UTC
Reply
Permalink
No surprise. It was easy with jTDS 15-20 years ago, but I think that
driver is deprecated now.
Post by Arne Vajhøj
1) enable SQLServer authentication (Windows authentication only will not
work)
It might be possible using pure-Java Kerberos, but getting that working
sounds like work:

https://learn.microsoft.com/en-us/sql/connect/jdbc/using-kerberos-integrated-authentication-to-connect-to-sql-server?view=sql-server-ver16
Post by Arne Vajhøj
2) download official Microsoft JDBC driver and transfer it to VMS
3) make sure TCP port 1433 is open in various firewalls
And voila - access from Java, Groovy, Kotlin, Scala and more
exotic JVM languages.
Arne Vajhøj
2024-08-27 01:33:26 UTC
Reply
Permalink
No surprise.  It was easy with jTDS 15-20 years ago, but I think that
driver is deprecated now.
Looks like last release is from 2013.

But it may still work fine. TDS is a very old protocol.

Using the official Microsoft driver is could be important for some though.
Post by Arne Vajhøj
1) enable SQLServer authentication (Windows authentication only will
not work)
It might be possible using pure-Java Kerberos, but getting that working
https://learn.microsoft.com/en-us/sql/connect/jdbc/using-kerberos-
integrated-authentication-to-connect-to-sql-server?view=sql-server-ver16
Yes.

The driver comes with:

mssql-jdbc_auth-12.2.0.x64.dll
mssql-jdbc_auth-12.2.0.x86.dll

which obviously will not work on VMS.

Arne
Arne Vajhøj
2024-08-27 01:46:16 UTC
Reply
Permalink
Post by Arne Vajhøj
No surprise.  It was easy with jTDS 15-20 years ago, but I think that
driver is deprecated now.
Looks like last release is from 2013.
But it may still work fine. TDS is a very old protocol.
It still works.

$ type jtds.groovy
import java.sql.*

con = DriverManager.getConnection("jdbc:jtds:sqlserver://arnepc5/Test",
"sa", "hemmeligt")
pstmt = con.prepareStatement("SELECT f1, f2 FROM t1")
rs = pstmt.executeQuery()
while(rs.next()) {
f1 = rs.getInt(1)
f2 = rs.getString(2)
printf("%d %s\n", f1, f2)
}
con.close()
$ groovy_cp = "jtds-1_3_1.jar"
$ groovy jtds.groovy
1 A
2 BB
3 CCC

Arne

Loading...