有人有用Actian的JCL检索数据到Java中松散耦合的普适数据库的例子吗?我连接到的数据库只有DAT文件。我的目标是在普及和MS之间创建一个链接。
我不是在找一个免费的,而是有人为我指明了正确的方向,这样我才能学习和成长。
谢谢你的进阶!
发布于 2017-07-11 03:59:20
在我的档案里找到了这个。不知道它是什么时候写的,它是否工作,或者这个接口是否仍然被支持。您没有说明您使用的是哪个版本的PSQL,所以我甚至不知道这是否适用于您的版本。
import pervasive.database.*;
public class VersionTest implements Consts
{
public VersionTest()
{
try
{
Session session = Driver.establishSession();
Database db = session.connectToDatabase("PMKE:");
XCursor xcursor = db.createXCursor(57000);
//Using local TABL.DAT (length 255 assures no leftovers!)
xcursor.setKZString(0,255,"plsetup\\tabl.dat");
//Open the file to load local MKDE
int status = xcursor.BTRV(BTR_OPEN);
System.out.println("Local Open status: " + status);
//Using remote TABL.DAT (length 255 assures no leftovers!)
xcursor.setKZString(0,255,"h:\\basic2c\\develop\\tabl.dat");
//set the buffer size
xcursor.setDataSize(15);
//get version
status = xcursor.BTRV(BTR_VERSION);
System.out.println("Version status: " + status);
// should be 15, always prints 5
System.out.println("Version length: " + xcursor.getRecLength());
System.out.println("Version: " + xcursor.getDString(0,15));
// try with an open file on a server
XCursor xcursor2 = db.createXCursor(57000);
//Using remote TABL.DAT (length 255 assures no leftovers!)
xcursor2.setKZString(0,255,"h:\\basic2c\\develop\\tabl.dat");
//Open the file
status = xcursor2.BTRV(BTR_OPEN);
System.out.println("Remote Open status: " + status);
//set the buffer size
xcursor2.setDataSize(15);
//get version
status = xcursor2.BTRV(BTR_VERSION);
System.out.println("Version status: " + status);
// should be 15, always prints 5
System.out.println("Version length: " + xcursor2.getRecLength());
System.out.println("Version: " + xcursor2.getDString(0,15));
// clean up resources
Driver.killAllSessions();
}catch(Exception exp)
{
exp.printStackTrace();
}
}
public static void main(String[] args)
{
new VersionTest();
}
}发布于 2017-07-12 19:33:41
Actian v12和v13仍然支持JCL。您可以在api.2.2.html上找到有关使用Actian检索数据的更多文档。
要链接到MS,您需要为PSQl数据文件创建用于关系接口的数据字典文件(DDF)。
https://stackoverflow.com/questions/45024720
复制相似问题