MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Two DatabaseLink issues

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52861] Two DatabaseLink issues
  • From: "Mark Fisher" <mark at markfisher.net>
  • Date: Wed, 15 Dec 2004 04:26:21 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

First issue: I was unable to connect to a mySQL database via
OpenSQLConnection. Here's what tech support said:

[begin quote]
Can you upgrade your jdbc drivers? Mathematica 5.1 ships with an older
version and it seems to be causing problems. You should delete (or
rename) the old one, which is located here:

<installation_dir_for_Mathematica/AddOns/Applications/DatabaseLink/Java/

The newer drivers can be found here:

http://www.mysql.com/products/connector/j/
[end quote]

That fixed the problem.

Second issue: A new problem arose as soon as I obtained a connection.
When I tried to get all the rows (there are about 330,000) I got an
error:

(Local) In[3]:=
in=SQLSelect[conn, "table_name"];

>From (Local) In[3]:=
JDBC::error: JDBC error: Null

It turns out that Java is running out of memory. (The error message is
not very informative.) By reading the code in DatabaseLink.m and SQL.m,
it is easy to see that InstallJava[] is being called. The fix is to
install Java with more than the default maximum memory allotment. Since
DatabaseLink has direct provision for this, the solution is to load
JLink and install Java *before* calling DatabaseLink:

<<JLink`
InstallJava[CommandLine -> "java -Xmx500m"]
<<DatabaseLink`

The command line switch increases the maximum memory for Java from its
default (60MB?) to 500MB. Java needed just under 400 MB for my query.
The ByteCount for the table in Mathematica is about 125 MB. I wonder if
DatabaseLink is taking advantages of the features available in the new
drivers. At the above-referenced URL, it says:

The driver now also supports "streaming" result sets, which allows
users to retrieve large numbers of rows without using a large memory
buffer.

That's all for now.

--Mark.


  • Prev by Date: Delete problem
  • Next by Date: Re: NMinimize constraint bug
  • Previous by thread: Re: Re: Delete problem
  • Next by thread: GUIKit - ScrollPane Tables within Wizard