Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Matematica Beginner/Student and Mysql

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122446] Re: Matematica Beginner/Student and Mysql
  • From: A Retey <awnl at gmx-topmail.de>
  • Date: Sat, 29 Oct 2011 07:08:07 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j8dtds$kff$1@smc.vnet.net>

Hi,

> Hello Everybody.. I hope this is the right place to post...

> I'm student and currently trying to connect a mysql database running
> locally on 127.0.0.1:3306 localhost, including the database
> Testdatabase with table Testtable.
> I try now to connect with Mathematica:
>
> Needs["DatabaseLink`"];
> SqlConnection[
>   JDBC["MySQL(Connector/J)", "localhost:3306/testdatabase"],
>   "Name" ->  "TestDB", "Username" ->  "root", "Password" ->  ""]
> conn1 = OpensqlConnection["TestDB"]
> SQLTableNames[conn1]
>
> Unfortunately my Ouptut is only a echo of what i wrote but not the
> result i'm looking for
> afterwards i would like to send standard sql queries to retrieve
> data...

Mathematica is case sensitive, so you want OpenSQLConnection. 
SQLConnection is not meant to be "defined" but is only a header for the 
expression that a correct OpenSQLConnection call will return and which 
can then be used for the other commands, like SQLTableNames. If you want 
to reuse a certain connection, you can save it with an associated name 
and then use that name as you tried in your OpenSQLConnection, see the 
section "Named Connections" in the databaselink tutorial about details 
(entering DatabaseLink/tutorial/DatabaseConnections#13985 into the 
documentation search field should directly navigate to that section). I 
would suggest you start with connecting to the example databases as 
shown in the DatabaseLink documentation. Once you have that working, you 
can try to open a connection to your MySQL database, with something like:

conn1 = OpenSQLConnection[
  JDBC["MySQL(Connector/J)", "localhost:3306/testdatabase"],
  "Name" ->  "TestDB",
  "Username" ->  "root",
  "Password" ->  ""]

> Anyone could help me? Step by step? I never used Mathematica before,
> but as my datasets are pretty large and manipulating data in tables is
> very convienient, i would really appreciate any help..

if you have not used Mathematica before, I would also suggest to first 
spend some time to get an overview of Mathematica before trying any 
serious work. It is powerful but has many pitfalls, especially if one is 
used to other systems/languages.

hth,

albert




  • Prev by Date: Re: Projecting 2d image on 3d object
  • Next by Date: FindInstance with all positive numbers
  • Previous by thread: Re: Mathematica Beginner/Student and Mysql
  • Next by thread: Re: Matematica Beginner/Student and Mysql