LocalDB support in Windows

Can we connect to LocalDB with either the Microsoft JDBC or JTDS plugins?

Most of the information I've found says "no," especially for Microsoft's plugin. JTDS seemed like it would work, but I have been unable to get that working.

http://stackoverflow.com/questions/11345746/connecting-to-sql-server-localdb-using-jdbc

A patch for JTDS was created in Novermber of 2013: http://sourceforge.net/p/jtds/bugs/716/.

Any other suggestions or ideas?

0
7 comments

Thank you, I've added this information to http://youtrack.jetbrains.com/issue/DBE-103 for developers to consider.

Regards,
Alexander.

0

What is the current workaround to connect with localdb?  I followed through the different links but was not able to make this work.  I'm relatively unfamiliar with jdbc.

TIA - Jeff Odell

0

Hi,
Here are the steps I took.

1) Clone the git repository and build it with JDK 6.

2) Get your LocalDB instance. I use the Nuget Package Manager console in VS 2013 to do this.

Capture3.PNG

3) Create the following Database Source Driver.

Capture.PNG

4) Create the following Database Source,
Capture2.PNG


When I test the connection, I get this error. I think it's unrelated, and I just have to install whatever the SSPI library is.
Capture4.PNG

0

To continue, I copied the 32 bit ntlmauth.dll from the jTDS build to the 0xDBE bin directories and restarted the IDE.

./lib/x86/SSO/ntlmauth.dll

C:\Program Files (x86)\JetBrains\0xDBE 138.1400.3\bin
C:\Program Files (x86)\JetBrains\0xDBE 138.1400.3\jre\jre\bin

This allowed me to connect and get a password prompt. Now I just need to figure out what my LocalDB password is ...

Capture.PNG

I added an additional user to the LocalDB.

Capture2.PNG

Then, I granted privileges. I was having trouble granting privileges via command line, so I cheated and used SQL Server Management Studio.

You *should* be able to do this with `GRANT EXECUTE TO testuser`, but I wasn't able to log in with "testuser" this way.

Right click on the database, and then "Properties." This will bring up the first window, and then click on "View server permissions."
Capture3.PNG

Finally, you'll see this when testing the connection.

Capture.PNG

By the way, both sqlcmd.exe and 0xDBE seem to have issues using databases with hyphens in their name.

Capture.PNG
Notice the lack of a tree arrow to see the tables and other objects.
Capture2.PNG

0

I was able to connect DataGrip to a LocalDb install. I documented everything here: https://youtrack.jetbrains.com/issue/DBE-103

I hope this helps someone else.

- Justin

0

Thank you, Justin!

0

Please sign in to leave a comment.