XPages and MS SQL

I am curious of what the best way or if its even possible to contact a MSSQL database via XPages. I can do it via Lotus Script, but I would much rather be able to do query’s on the fly.

I can hit the IBM-DB2 server no issue (using java.sql from jmackey.net blog), but when I try to hit our SQL server I can’t get a connection. I have downloaded a driver from Microsoft, but I am not sure notes is recognizing it.

Just sort of at a lost here. If I can talk to the MSSQL database, via Notes/XPages, it would make my life a lot easier.

Thanks for any tips and/or suggestions.

Tony

Subject: You can do this using Java in your XPage

Use the Java classes to read the data and use it on your XPage. We cover this in our new XPage 2 Development course.New Advanced XPages Course!

Howard

Subject: MS SQL Server JDBC

The free JDBC driver for MS SQL Server is your friend here…

Subject: Driver Not Found

JP-

Here is a snippet of my java code, but I am getting the error “no suitable driver”. I have the jar files copied over to my “Domino\xsp\shared\lib” directory. Is there something I am missing?

		Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

String connectionUrl = connDB+“;user=”+connUserName+“;password=”+connPwd+“;”;

Connection con = DriverManager.getConnection(connectionUrl);

Statement st = con.createStatement();

Thanks for your help

Subject: Restart the server.

As it happens I’ve just dropped the jar file onto our Production server, and restarting HTTP doesn’t find the new jar file. So I will have to wait until tonight to restart it.

Subject: Almost There, Thanks

Thanks for your help. I am getting close. I had installed the drivers and updated the classpath the other day. Server has been rebooted and now I am getting:Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.

So I am updating the class path once more and hopefully that will do it. Unless you have any ideas. I am under the assumption that the class path is what drives which .jar file to use (if thats not right please let me know). I am new to this java world so learning as I go.

Thanks again.

Tony

Subject: class path

Anthony,

How did you update the class path? I’m having a similar problem.

I downloaded the MS JDBC driver (sqljdbc_3.0.1301.101_enu.exe), unzipped the file and copied over ‘only’ the sqljdbc4.jar file to domino/jvm/lib/ext folder and then rebooted the folder. Was I supposed to copy over the other files extracted from the package?

However, i get the following error: XPages java.sql.SQLException: No suitable driver

Thanks,

Dan

Subject: I think only have the sqljdbc4.jar in that folder

I.e. make sure the sqljdbc.jar is not in there, as I think it uses that first.

Subject: Thanks.

That worked and I am golden.

Thanks again.

Tony