4
$\begingroup$

I am inserting lots of data into the preinstalled SQL Database in MM:

con= OpenSQLConnection["demo"] > SQLCreateTable[con, SQLTable["anyname"], SQLcolums] > ...

I am running out of disk space on my laptop, so I would love to create an SQL Database on my external USB 3 disk drive. I tried getting it done with the MM DatabaseLink Userguide, but it seems to exceed my understanding. Is there an easy way to do this?

Thanks and regards

Patrick

......

Ok, figured out how to change the storage directory (F = external device):

(* Create Database Folder *)

DBconn = OpenSQLConnection[JDBC["HSQL(Standalone)", "F:\PDB\PDB"], "Name" -> "Database", "Username" -> "Anonymous", "Description" -> "No Description", "Version" -> DatabaseLinkInformation$VersionNumber];

(* Define Table Structure *)

tablestructure = {SQLColumn["column_1", "DataTypeName" -> "INTEGER"], SQLColumn["column_2", "DataTypeName" -> "INTEGER"]};

(* Create Table *)

SQLCreateTable[DBconn, SQLTable["mytable"], tablestructure];

(* Insert any data *)

SQLInsert[DBconn, "mytable", {"column_1", "column_2"}, {{11, 22}, {33, 44}}];

(* Check for success *)

SQLSelect[DBconn, "mytable", ShowColumnHeadings->True] // TableForm;

$\endgroup$
  • $\begingroup$ Thanks for your comment.Setting the location does not change the storage path, which is here : FileNameJoin[{$UserBaseDirectory, "DatabaseResources", "Examples", "demo"}]. $\endgroup$ – Patrick Bernhard Oct 8 '14 at 9:44
  • $\begingroup$ myconn = OpenSQLConnection["demo", "Location" -> "F:\\Test"]; SQLCreateTable[myconn, SQLTable["anyname"], SQLcolums]; SQLInsert[myconn, "anyname", SQLcolums[[All, 1]], Take[SQLtestdata, 10]]; ... stored in preinstalled SQL database. Error in code? $\endgroup$ – Patrick Bernhard Oct 8 '14 at 9:51
  • $\begingroup$ @rhermans Take it easy. Mma docs are not easy to navigate, read and understand when you're starting. $\endgroup$ – Dr. belisarius Oct 8 '14 at 10:39
  • $\begingroup$ My apologies, it was unfair to assume this was yet another trivial question. My wrong. $\endgroup$ – rhermans Oct 8 '14 at 10:41
  • $\begingroup$ all good, no offense taken $\endgroup$ – Patrick Bernhard Oct 8 '14 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.