You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

dilettante

Beginner

  • "dilettante" started this thread

Posts: 8

Date of registration: Jan 28th 2011

  • Send private message

1

Saturday, June 25th 2011, 12:56am

NullPointerException in ExecuteStatement on PC-BSD

I have a small test program that works fine in Windows, but after dragging its JAR file and installing Java on PC-BSD (a flavor of FreeBSD) it fails:

Quoted

java.lang.NullPointerException
at VB.Database.ExecuteStatement(DataBase.jsrc)
at Form1.Form_Load(Form1.jsrc:16)
at ...





I've also noticed that both App.Path and CurDir$() return values that are "off a bit" on this platform, but for all I know it has something to do with the way the filesystem there handles vitual folders like Desktop. I'm putting the JAR file and the MDB file into a folder on the PC-BSD Desktop.

Hard-coding paths did not help get rid of the exception though.

I'm also not really expecting to be able to open a Jet MDB over there, however I note that ConnectMDB does not seem to be using the native Jet Engine even on Windows, so I thought I'd give it a shot.

Code fragment:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Option Explicit

Import java#sql

Private RS As ResultSet 
Private Meta As ResultSetMetaData

Public Sub Form_Load() 
   Dim Col As Integer 
   Dim DateVal As Date 
   Dim StrVal As String 
   Dim DateFmtr As New SimpleDateFormat("yyyy-MM-dd") 

   MsgBox CurDir$() & "/test.mdb" 
   Database1.ConnectMDB CurDir$() & "/test.mdb" 
   Set RS = Database1.ExecuteStatement("SELECT * FROM Employees") 
   Set Meta = RS.getMetaData() 
   With JBGrid1


Suggestions?

dilettante

Beginner

  • "dilettante" started this thread

Posts: 8

Date of registration: Jan 28th 2011

  • Send private message

2

Saturday, June 25th 2011, 1:02am

Actually the App.Path and CurDir$() seem to always return the BSD "CD" which in my case is set to the Documents folder.

However copying the JAR and MDB into Documents still does not get around the NullPointerExecption.

dilettante

Beginner

  • "dilettante" started this thread

Posts: 8

Date of registration: Jan 28th 2011

  • Send private message

3

Saturday, June 25th 2011, 3:25pm

Hmm, this fails to raise a MsgBox dialog at all on PC-BSD, then fails again on the next statement:

Jabaco Source

1
2
MsgBox "ConnectMDB() = " & CStr(Database1.ConnectMDB("test.mdb")) 
Set RS = Database1.ExecuteStatement("SELECT * FROM Employees")

dilettante

Beginner

  • "dilettante" started this thread

Posts: 8

Date of registration: Jan 28th 2011

  • Send private message

4

Saturday, June 25th 2011, 3:41pm

I'm going to consider this closed as "Jabaco does not provide a portable Jet Engine emulation." In other words there is no way to use Database.ConnectMDB() except on Windows.

This is fine, I just wish I'd read this somewhere here - but perhaps I simply missed it.

Works fine on Windows though.

Rate this thread
WoltLab Burning Board