Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6010

Re: Mathematica Beginner/Student and Mysql

From "McHale, Paul" <Paul.McHale@excelitas.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mathematica Beginner/Student and Mysql
Date 2011-10-29 11:26 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8gnsl$5hr$1@smc.vnet.net> (permalink)
References <201110280935.FAA20781@smc.vnet.net>

Show all headers | View raw



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@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@gmail.com]
Sent: Friday, October 28, 2011 5:36 AM
Subject: 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


Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Mathematica Beginner/Student and Mysql "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-10-29 11:26 +0000

csiph-web