Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

PHP-Java RESTful (like) Server for MVDBMS

200 views
Skip to first unread message

Andrew Cole

unread,
Jan 25, 2019, 2:28:44 PM1/25/19
to Pick and MultiValue Databases
Hello,

So this morning I uploaded a modified version of my Java and PHP programs to github. The programs were used to establish communications between our e-commerce PHP application to our old mvBase system. Now that we're on Jbase (LOVE it) we don't use this anymore and I'm able to at least share the code (albeit significantly modified). I figured I would share it here in case anyone was interested or looking to do something similar with their own mvdbms flavor. Here's a quick run down of what the program does:

PHP Class
  • Performs the initial CRUD calls
  • Formats the raw data into multidimensional array
  • Makes use of mySQL to keep track of certain info for files. (Default file length for padding arrays, names for use with __get() and __set() methods [think DICT]). This could very easily be removed, I just liked accessing attributes via name as opposed to [i].
  • Allows for calling subroutines as well as EXECUTE statements
Java Server
  • Use's Rocket's MVSP API to pool connections as needed.
  • Takes JSON requests to perform CRUD, CALL, and EXECUTE. Keep in mind this was developed before REST had standards so it's not your usual GET, POST. PUT, DELETE, etc.
If mvBase ran on linux we probably would have tried to use this to actually drive our e-commerce site and I suspect it could if you were using d3. It's untested on d3 but as both mvBase and d3 share MVSP I would imagine it would work out of the box.

Here's the link for any that are interested: https://github.com/andrewcole50/MV-Java-Server

Tony Gravagno

unread,
Jan 25, 2019, 5:11:30 PM1/25/19
to Pick and MultiValue Databases
Andrew - as just another community member here, I'll thank you for your contribution.
I think it's very helpful for the community to have FOSS libraries for learning, and your MIT license permits anyone to use this for commercial purposes as well.

I do a lot with PHP in WordPress, MantisBT, and other packages, and I do a lot of Java work as well. Public REST libraries may encourage people to create plugins which integrate with MV using these common FOSS apps, and that can help to keep more MV systems in service.

For anyone who wants to learn about MVSP, your MultiServerThread.java code should be very educational.

Will you be adding the JREAD and other BASIC subs to the repo?

MVSP actually does include a PHP library in the Java package (yeah, they hid it on us). But Rocket doesn't keep it current with PHP versions. I think the last build was for PHP 5.x where 7.x is current.

MVSP only works with mvBase 3.x so older systems still need to use other methods ( I have a connector for v1.3+ but it's not FOSS. )

MVSP supports session pooling, but this FOSS implementation should be very helpful.

As I understand it, Rocket's MVST is an application for creating a REST interface around MVSP connections, and it supports session pooling. I believe MVST is free but pooling is licensed. So while you wrote this library for your own purposes before MVST, I will think of this more as a FOSS alternative than as a unique option, and both options have their own positive value.

Regards
T

Andrew Cole

unread,
Jan 28, 2019, 8:43:37 AM1/28/19
to Pick and MultiValue Databases
Yeah my main goal was just to get some example code out there. I learned Java and PHP mostly through stack overflow and example code. There's a severe lack of MV related example code out there.

A few extra points:

I saw that they started offering a PHP connector a few years back but by that time we already had this system in place so there wasn't much of a draw to migrating.

I believe session pooling is only enabled for d3 connections and not mvBase. I vaguely recall when they released that and I remember being bummed (not surprisingly) that it was d3 only.

I've played around with Rocket's REST interface and I could not get it to work and I didn't exactly like how overly complicated and restricted it was. Now with that said, a chunk of my problems could very well be the fact we were on mvBase and not d3. MVST might work swimmingly on d3.

The BASIC routines are in a different repo which can be found here: https://github.com/andrewcole50/MVUtils

Thanks Tony!

Tony Gravagno

unread,
Jan 28, 2019, 6:53:39 PM1/28/19
to Pick and MultiValue Databases

I understand that this is as-yet unconfirmed, but I don't know if session pooling is only for D3, not mvBase. That might be old news.


[Ad]

Session pooling is available for mvBase v2+ with mv.NET. I have a client who was using mv.NET to support a PHP site. I use it to support Java, PHP, and .NET sites. People easily confuse mv.NET as being useful only for .NET. It's quite useful for pooling, executing code on remote systems, and many other things, and it includes features to generate RESTful web services. For the cost of developing a custom REST or pooling interface into an existing application I may be able to help a company to integrate mv.NET.


I also have a custom pooling connector in Java for mvBase 1.3+, and while I wouldn't recommend it, it could probably be used for other older systems that can't use the newer commercial offerings.

[/Ad]


Your Java FOSS pooling mechanism could probably be used for any MV platform where the objects in the pool are of any platform-independent type. I was working on a related FOSS project a long time ago called mvEsperanto. It was kinda grandiose and never got a good start. I might resurrect that with your code if we see there's any uptake.


T


Disclaimer: Nebula Research and Development is a reseller for mv.NET and D3 in North America and provides related licenses, product support, and consultation and development services.

Sales < at > Nebula-Rnd

dot com

Andrew Cole

unread,
Jan 29, 2019, 7:23:33 AM1/29/19
to Pick and MultiValue Databases
I just checked and I don't see anywhere in the docs that mvBase does not support it so I would imagine it is supported now. Like I said before, that may not have been the case at launch but I don't remember. 

I had forgotten I have a version of this using Jbase's Jremote. I did it as a replacement as opposed to an option in the program. Depending on how easy it is to implement, I may add it to the repo as an option. Theoretically that would make this program functional with Jbase, d3, mvBase, and U2. A decent headstart for anyone (like yourself) wanting create a platform-independent server like you mentioned.

Andrew Cole

unread,
Jan 30, 2019, 7:57:26 AM1/30/19
to Pick and MultiValue Databases
FWIW, I spent a little time yesterday to merge a few of my projects into an actual REST server for MVDBMS. I've tested all of the CRUD, SUBROUTINE, and EXECUTE functions with JBase and all of them work except EXECUTE. I do not have a mvBase system to test against anymore but I pretty much copied the code direct from my pre-REST mvBase version. If anyone was interested in testing against a d3, mvBase, or U2 system I'd be happy to help troubleshoot/fix it. I haven't taken the time to add a README or add in comments yet but anyone at least partially familiar with the technologies should be able to figure out what's going on. I'm thinking of adding a switch to use my "enhanced" JREAD/WRITE or to use the basic READ/WRITE.

Also, if anyone wanted to try this with a system that's not included I could probably do that. I would just need the Java library for whatever flavor you want.

Reply all
Reply to author
Forward
0 new messages