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

MathGroup Archive 2011

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

Search the Archive

Re: Mathematica Beginner/Student and Mysql

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122477] Re: Mathematica Beginner/Student and Mysql
  • From: "McHale, Paul" <Paul.McHale at excelitas.com>
  • Date: Sat, 29 Oct 2011 07:13:45 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110280935.FAA20781@smc.vnet.net>


Here is what I do...

(* I check to see if it is open before I try *)
Needs["DatabaseLink`"]
myConn=If[SameQ[Head[myConn],SQLConnection],myConn,
OpenSQLConnection["Mrp", "Username"->"mrpadmin", "Password"->"1734admin"]]

(* define the sql string *)
str1="SELECT SerialNumber,  DateTime, OptionName, IndexNumber, Text, Scenario
FROM MyView
WHERE (Text='Passed') AND (IndexNumber=22) AND (Scenario LIKE'Acceptance%')
ORDER BY IndexNumber";

(* execute the sql string *)
mTestList=SQLExecute[myConn,str1];


Some notes:
1. If you use GUID, you must create a view which replaces them with some other type.  Mathematica freaks out on GUIDs.
2. You must go into Start Menu -> All Programs -> Administrative Tools -> Data Sources ODBC

Make sure you add a connection to your database.  I seem to remember a catch22.  You must be able to  select the database in menu when you type only:

Needs["DatabaseLink`"]
OpenSQLConnection[]


If it is not there, the driver is not configured properly.  Use the System DNS tab in windows to configure it (in above path).

If you try to view a relational database with their previous viewer you would get an erroneous error due to GUID.  I think this avoidable.  You must call the named database directly.  You must call a view that resolves GUID.




Paul McHale  |  Electrical Engineer, Energetics Systems  |  Excelitas Technologies Corp.

Phone:   +1 937.865.3004   |   Fax:  +1 937.865.5170   |   Mobile:   +1 937.371.2828
1100 Vanguard Blvd, Miamisburg, Ohio 45342-0312 USA
Paul.McHale at Excelitas.com
www.excelitas.com



Please consider the environment before printing this e-mail.
This email message and any attachments are confidential and proprietary to Excelitas Technologies Corp. If you are not the intended recipient of this message, please inform the sender by replying to this email or sending a message to the sender and destroy the message and any attachments.
Thank you

-----Original Message-----
From: ejules [mailto:weberejules at gmail.com]
Sent: Friday, October 28, 2011 5:36 AM
To: mathgroup at smc.vnet.net
Subject: [mg122477] Matematica Beginner/Student and Mysql

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...
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..

Thank you! ejules





  • Prev by Date: Re: Matematica Beginner/Student and Mysql
  • Next by Date: Re: Problem with Solve and NSolve
  • Previous by thread: Re: Matematica Beginner/Student and Mysql
  • Next by thread: Re: Matematica Beginner/Student and Mysql