1
votes

I'm trying to make "Wolfram Mathematica" to manipulate a *.accdb file. I already established a connection (to a file with an empty "table1"):

Needs["DatabaseLink`"]
conn = OpenSQLConnection[]

Source: http://reference.wolfram.com/language/DatabaseLink/ref/SQLInsert.html

It works fine. If I make:

SQLSelect[conn, "table1"]

I get

 {}

Now I want to create a table with:

SQLCreateTable[conn, 
  SQLTable["TEST"], {SQLColumn["COL1", "DataTypeName" -> "INTEGER"], 
   SQLColumn["COL2", "DataTypeName" -> "DOUBLE"]}]; 

I get the exception:

Java::excptn: A Java exception occurred: java.lang.NullPointerException at net.ucanaccess.jdbc.UcanaccessPreparedStatement.clearParameters(UcanaccessPreparedStatement.java:214) at com.wolfram.databaselink.SQLStatementProcessor.processSQLStatement(SQLStatementProcessor.java:311).

Sorry for bad english (but I tried).

Thank you guys!

2

2 Answers

0
votes

I think you need to specify a database, e.g.

conn = OpenSQLConnection["demo"]
0
votes

Sometimes if you "open the same connection" many times Mathematica doesn't understand what to do. Just

Quit

the Kernel and re-establish the connection. SQL will work properly.