Database - connecting to SQL Server

1,577 views
Skip to first unread message

Jason M

unread,
Mar 23, 2012, 4:21:13 PM3/23/12
to pwm-general
Receiving error:

=====

Database server is not available: 5051 ERROR_DB_UNAVAILABLE (get
operation failed: com.microsoft.jdbc.sqlserver.SQLServerDriver)

=====

Does anyone have a sample configuration for connecting to SQL Server
that they might be willing to share? Having trouble getting connected
- this is what my latest try was:

Dropping the MS jar files in the WEB-INF/lib directory. I've also
dropped them in the application server's lib directory.

Database Class
com.microsoft.jdbc.sqlserver.SQLServerDriver

Database Connection String
jdbc:sqlserver://SQLSERVERNAME:1433;databaseName=pwmDB

Username and password are valid and set in pwm configuration, I can
successfully telnet from the pwm server to the SQL server on port 1433
so it's not a firewall issue. I've never dealt with jdbc before, so I
assume my strings are wrong.


Thanks in advance!

Menno Pieters

unread,
Mar 23, 2012, 4:34:25 PM3/23/12
to pwm-g...@googlegroups.com
On Fri, Mar 23, 2012 at 9:21 PM, Jason M <ja...@jasonm.com> wrote:
Receiving error:

=====

Database server is not available: 5051 ERROR_DB_UNAVAILABLE (get
operation failed: com.microsoft.jdbc.sqlserver.SQLServerDriver)

=====

Does anyone have a sample configuration for connecting to SQL Server
that they might be willing to share?  Having trouble getting connected
- this is what my latest try was:

Dropping the MS jar files in the WEB-INF/lib directory.  I've also
dropped them in the application server's lib directory.

Database Class
com.microsoft.jdbc.sqlserver.SQLServerDriver

Database Connection String
jdbc:sqlserver://SQLSERVERNAME:1433;databaseName=pwmDB

Perhaps this helps:  http://support.microsoft.com/kb/313100/en

Regards,

Menno


Jason Rivard

unread,
Mar 24, 2012, 10:47:00 PM3/24/12
to pwm-g...@googlegroups.com
Another option is to consider using JTDS.  I have almost always used the JTDS driver for connecting to SQL Server instead of Microsoft's connector:


There's no reason MS's driver shouldn't work with PWM, but I've personally used the JTDS driver.  Unfortunately I don't have a sample connection string handy for you...

--
You received this message because you are subscribed to the Google Groups "pwm-general" group.
To post to this group, send email to pwm-g...@googlegroups.com.
To unsubscribe from this group, send email to pwm-general...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pwm-general?hl=en.

Jason M

unread,
Mar 25, 2012, 8:42:46 PM3/25/12
to pwm-general
Menno,

Thanks for the link. I had previously found that page but it was not
helpful in finding my issue.

Jason M

unread,
Mar 25, 2012, 8:45:12 PM3/25/12
to pwm-general
Jason,

Thanks for the help - I did not think of searching for alternatives to
the MS jdbc driver. Was able to get connected to the SQL Server
database using jtds and the following strings:

Database Classs
net.sourceforge.jtds.jdbc.Driver

Database Connection String
jdbc:jtds:sqlserver://SQLSERVERNAME:1433/pwmDB

Anson

unread,
May 15, 2012, 10:55:18 PM5/15/12
to pwm-g...@googlegroups.com
Jason M,

I was recently able to get the latest Microsoft provided JDBC driver to work with the following settings:

Database Class: 
com.microsoft.sqlserver.jdbc.SQLServerDriver

Database Connection String: 
jdbc:sqlserver://SQLSERVERNAME:1433;DatabaseName=pwmDB

You also have to copy the correct JAR file into pwm/WEB-INF/lib/ ... since I was using JDK 1.6, I had to use the sqljdbc4.jar file.  Also, adding a new JAR file to your lib folder usually requires a reset of the application server (e.g. Tomcat).

I think your original issue may have been related to the "Database Class" string; the "sqlserver" and "jdbc" portions looked swapped.

FYI,
-Anson
Reply all
Reply to author
Forward
0 new messages