0

I guess I have a strange error while insert a record in a SQLJet database. I open the database connection and use following code to insert a test record.

ISqlJetTable tbl = db.getTable("file");
tbl.insert("filename");

Eclipse shows me a red icon with the info message

The method insert(Object[]) in the type ISqlJetTable is not applicable for the arguments (String).

What went wrong? If I remember rightly on my mac I don’t get this error message. I’m sorry I haven’t access to my mac at the moment. How to fix this? The tutorial use the same way. Greetz

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
Andre Hofmeister
  • 3,185
  • 11
  • 51
  • 74

1 Answers1

1

The method insert(Object[]) in the type ISqlJetTable is not applicable for the arguments (String).

You need to pass String[]/Object[] instead of just String. Based on documentation syntax for insert method is insert(Object[] arr)

kosa
  • 65,990
  • 13
  • 130
  • 167
  • Yea, but in the tutorial they also just pass a `Stirng` or I’m wrong? Im sure that on my mac, this code works. Greetz – Andre Hofmeister Aug 01 '12 at 19:25
  • Then you need to make sure which version you are using, may be you are using older version on mac. – kosa Aug 01 '12 at 19:26
  • I’m sure that I use on both machines `org.tmatesoft.sqljet_1.1.4.r1226_v20120717_1620.jar` I will have a call and check this out, thats interesting :) Thanks. – Andre Hofmeister Aug 01 '12 at 19:28
  • I would suggest verify one more time. I am confident that there is some mismatch. – kosa Aug 01 '12 at 19:28
  • Ok I have checked it. Same version on both machines. I pushed and pulled the repo, if I run the code on the mac it works quit nicely, on the pc it get the error. Greetz. – Andre Hofmeister Aug 01 '12 at 19:46
  • Check eclipse--Project--Properties--lib and see which jar you have there. – kosa Aug 01 '12 at 19:50
  • Ok, I found the problem. It looks like the JRE System Library is the problem. On the mac the project uses `Java SE6 (MacOS X Default)` on the Windows PC it uses `J2SE-1.4` if I change this to `Workspace default JRE (jr6)` the code runs fine. I’m sorry I don’t know if I have changed this by a mistake! Or if it is a problem with using the same project on a mac and on a pc. Thanks for your reply. I wish a nice day or evening! Btw, the libs where equal. – Andre Hofmeister Aug 01 '12 at 20:00