4

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;

Patrick Bernhard
  • 707
  • 5
  • 12
  • Thanks for your comment.Setting the location does not change the storage path, which is here : FileNameJoin[{$UserBaseDirectory, "DatabaseResources", "Examples", "demo"}]. – Patrick Bernhard Oct 08 '14 at 09:44
  • 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?
    – Patrick Bernhard Oct 08 '14 at 09:51
  • @rhermans Take it easy. Mma docs are not easy to navigate, read and understand when you're starting. – Dr. belisarius Oct 08 '14 at 10:39
  • My apologies, it was unfair to assume this was yet another trivial question. My wrong. – rhermans Oct 08 '14 at 10:41
  • all good, no offense taken – Patrick Bernhard Oct 08 '14 at 11:45

0 Answers0