OpenSQLConnection error


I used to be able to connect to a SQL Server database. I haven't run this program for a few months. I tried it today and it failed, so I went back to try OpenSQLConnection[] and got the following error:

StringJoin::string: String expected at position 2 in server:1433/<>database.

I began my program with:


I tried to connect to my database anyway, but that returned:

OpenSQLConnection[JDBC[Microsoft SQL Server(jTDS),
server:1433/ <> database],  "Catalog" -> TOA_DW,
Description -> The reinsurance data warehouse.  Connection
created on September 5, 2013., Location->
DatabaseResources\warehouse.m, Name -> warehouse, 
Password ->  , Properties -> {}, 
ReadOnly -> False, RelativePath -> False, Timeout -> Automatic,
TransactionIsolationLevel -> ReadUncommitted, 
UseConnectionPool -> False, Username -> , Version -> 2.]

When I ran SQLConnections[] I got nothing.

Then I tried to connect to the demo database. Got the same initial error when I executed OpenSQLConnection[]. I manually tried to connect to demo through the UI and got a bunch more of the same "StringJoin" errors. However when I ran SQLConnections[] I did get:

{SQLConnection["demo", 1, Open, TransactionIsolationLevel -> ReadCommitted]}

Which I think means that it connected.

There have been some changes to permissions that were put into place since the last time I ran this successfully. However OpenSQLConnections[] isn't specifying anything, so I wonder why I got that initial "StringJoin" error. Also, I can connect to my database using the SQL Management Studio.

Can anyone suggest where to start looking for the problem?

Mitchell Kaplan

Posted 2014-01-30T19:38:10.270

Reputation: 3 474

What that error message means is that is that database has not been defined. It should be a string, right now it's not. – C. E. – 2014-01-31T07:53:09.753

@Pickett - I thought that by entering OpenSQLConnection without any parameters I could enter the database through the resultant UI. Then I would save it as a connection along with the database server, and various other parameters. What am I missing? – Mitchell Kaplan – 2014-01-31T12:02:43.400

You haven't shared the code that defines database so I can't tell you what's wrong, but for some reason it's not a string and so StringJoin throws that error. – C. E. – 2014-01-31T13:32:46.550

@Pickett - I haven't defined "database" anywhere. I assume that you're referring to a constant called "database" that I should have assigned a value to? I'm not using anything called database. Am I misunderstanding you? Also, the code that worked a few months ago is untouched and doesn't work now. I must be misunderstanding. – Mitchell Kaplan – 2014-01-31T13:48:34.780

Oh sorry, WITHOUT any parameters... I thought that was your code. I've never used the GUI so I'm afraid I cannot help. – C. E. – 2014-01-31T14:13:39.380

@Pickett - Thanks anyway, I appreciate that you made the effort to try to help. – Mitchell Kaplan – 2014-01-31T14:15:35.250



My problem was solved by Wolfram support. Apparently there was some corruption in one or more Mathematica files. We solved the problem by deleting the following folders (Windows 7, 64 bit):



When I then ran Mathematica, it recreated these folders and the error went away.

Mitchell Kaplan

Posted 2014-01-30T19:38:10.270

Reputation: 3 474

This solved my issue as well. I did have to reactivate when I started the program after deleting the directories so make sure you have your activation key handy. – Rudy Potter – 2019-08-29T22:54:10.370