2
$\begingroup$

What is the syntax for connecting to a specific instance of a sql server database?

Here's my code:

Needs["DatabaseLink`"];
conn1 = OpenSQLConnection[
  JDBC["Microsoft SQL Server(jTDS)", "ARC-WEB/SKWSPATIAL"], 
  "UserName" -> "Mathematica", databasename = "XYZ_Database", 
  "Password" -> "xxxxx"]

I have no problem connecting to ARC-WEB but cannot connect to one of the other instances. Mathematica 9.0 SQL Server 2008

$\endgroup$
7
  • $\begingroup$ Did you try "Name"->"XYZ_Database"? To me databasename = "XYZ_Database" does not look like a correct syntax.. $\endgroup$ Apr 11, 2014 at 14:45
  • $\begingroup$ I changed to code from databasename to Name and no changes. $\endgroup$
    – TheHiker
    Apr 11, 2014 at 15:04
  • $\begingroup$ You used a = instead of -> for an option. You seem to have forgotten the quotes as well. $\endgroup$ Apr 11, 2014 at 15:26
  • $\begingroup$ You have database name that, I think, should be "Name", i.e. in quotes. You also have = not -> for that option. $\endgroup$
    – Ymareth
    Apr 11, 2014 at 15:27
  • $\begingroup$ @Sjoerd - Snap :) $\endgroup$
    – Ymareth
    Apr 11, 2014 at 15:28

1 Answer 1

2
$\begingroup$

After looking at all the comments I was able to come up the following code that allows me to connect and query the database:

Needs["DatabaseLink`"];
conn1 = OpenSQLConnection[
  JDBC["Microsoft SQL Server(jTDS)", "ARC-WEB"], 
  "UserName" -> "Mathematica", "Instance" -> "SKWSPATIAL", 
  "database" -> "yyy", "Password" -> "xxx"]

Thanks for all your help!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.