0

So I'm working on a project using a SQL Server 2008 database. It uses Java with Hibernate. I was doing some work on it last week, it was working (relatively) fine. I came back to it today and all of the sudden Hibernate can't login or connect to the database. I suspect the problem is in SQL Server because I tried connecting to it with JDBC but that didn't work either.

Server authentication is set to "SQL Server and Windows Authentication mode"

my users "dummy" and "root" have "Grant" check on all explicit permissions.

The username and password I enter are correct. I know this because I can log in o SQL Server Management Studio with those logins and run queries.

The database is on a Windows XP virtual machine and I'm using Eclipse on my host machine. I have Port Forwarding and everything set up with Oracle VirtualBox (like I said, it was working fine last week).

Any suggestions?

--EDIT--
See the comments below the original post

---EDIT---
I made a discovery. My Java project is not even getting connected with the SQL Server. When I fail a log in with a .udl test, a log message is created for the failed login. But whenever I fail to login using my Java project on my host machine, there are logs created.
I should also point out that I can connect to a MySQL database running on the same VM and run queries on it just fine.
Is there something wrong with this URL String? "jdbc:sqlserver://192.168.56.1:1433;databaseName=MLB;user=dummy;password=123"
I can confirm that the IP Address, Port number, database name, username, and password are all correct.

  • First thing I always do on a connection error is create on my system containing the application a .udl file. Just create a new txt file and change its extension to .udl. When thats open, place all the sql credentials your feeding your application into the .udl and click test connection. – Cyassin Apr 22 '14 at 22:35
  • I've never used a .udl. What do I use as the "server name"? – Abraham Church Apr 22 '14 at 22:43
  • An ip address, or hostname if it is not local. If local, just place whatever sql management studio has as its server name when logging in. Often it is (local) – Cyassin Apr 22 '14 at 22:46
  • Ok well I've been using the IP address mapped to my Windowx XP VM: 192.168.56.1. I've tried that, and it can't load any databases on the server because the Login always fails. – Abraham Church Apr 22 '14 at 22:48
  • Then I believe the error may lie in the user setup in SQL itself. Does it work correctly using the .udl in the VM? – Cyassin Apr 23 '14 at 00:25
  • The test connection succeeded when I put the .udl file on the VM. The server name is "CEDAVILLE-CS-VM" apparently. – Abraham Church Apr 23 '14 at 00:30
  • Check your connections then. That is likely the issue. – Cyassin Apr 23 '14 at 00:50
  • Well what should the "Server name" be when I try use the .udl file on the host machine? "CEDAVILLE-CS-VM"? "192.168.56.1/CEDAVILLE-CS-VM"? – Abraham Church Apr 23 '14 at 04:02
  • Also, my Java program successfully connects to a MySQL database also on the VM, so I would think the only possible problem would be a Port issue but as far as I can tell all the right ports are open. – Abraham Church Apr 23 '14 at 04:43

1 Answers1

0

I figured out the answer myself. I had install SQL Server 2014 on my host machine and somehow that conflicted with some settings somewhere. Once I unistalled SQL Server 2014 from my host machine all of my problems went away.