2010-02-10

Options for connecting Mathematica to a MS SQL server

The following is just an example of connecting to a SQL database (actual names changed slightly)  Also showing the slightly naughty habit of using the user sa.

In[1]:= Needs["DatabaseLink`"]

In[2]:= conn =
OpenSQLConnection[JDBC["Microsoft SQL Server(jTDS)", "MyServer"],
  "Catalog" -> "MyDemo", "Username" -> "sa",
  "Password" -> "RubyPane"]

Out[2]= SQLConnection[2, "Open", "Catalog" -> "MyServer",
"TransactionIsolationLevel" -> "ReadCommitted"]

This is a useful link for getting SQLExpress to work (basically don't try the integrated security):

http://softwaresalariman.blogspot.com/2007/04/jdbc-to-sql-server-express.html

Which gets me to:

s[] := OpenSQLConnection[
  JDBC["Microsoft SQL Server(jTDS)",
   "127.0.0.1:1433/Test;user=sa;password=sa"],
  "Catalog" -> "TestTercero", "User" -> "sa", "Password" -> "sa"]

1 comment:

Unknown said...

Thanks for putting it up - always a bore to find the syntax