MSSQL configuration
multiplex77 Jun 8, 2003 11:42 PMHi,
I'm very new to JBoss and J2EE. I've been trying to get my JSPs to access my MSSQL database.
Here's what I've done:
1. Downloaded and installed the MSSQL 2000 JDBC driver.
2. Edited the \server\default\deploy\mssql-ds.xml file:
-----------------------------------
<local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://server1:1433;DatabaseName=Test;User=sa;Password=passwd;SelectMethod=Cursor</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
Test
<user-name>sa</user-name>
passwd
<min-pool-size>100</min-pool-size>
<max-pool-size>1000</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
</local-tx-datasource>
3. I edited the "C:\jboss\bin\run.bat" file and inserted into the second line:
"set CLASSPATH=c:\mssql_jdbc_driver\lib\mbase.jar;c:\mssql_jdbc_driver\lib\msutil.jar;c:\mssql_jdbc_driver\lib\mssqlserver.jar;"
where C:\mssql_jdbc_driver is the folder where my *.jar files are located.
4. I created a .jsp page like this:
-----Start test.jsp -----------
<%
try {
String sDBDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String sConnStr = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=multiplex;User=sa;Password=secret;";
Class.forName(sDBDriver);
java.sql.Connection conn = java.sql.DriverManager.getConnection(sConnStr);
java.sql.Statement stmt = conn.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("select 'Multiplex' As Name");
while (rs.next()) { %>
<%= rs.getString("Name") %>
<%}
}
catch (ClassNotFoundException cnfe)
{
System.err.println("Unable to load MSSQL database driver!");
System.err.println("ClassNotFoundException: " + cnfe.getMessage());
}
%>
------End test.jsp -----------------------
5. But then when I run test.jsp, I get a ClassNotFoundException saying its not able to load the MSSQL driver.
Have I missed out some configuration step? I've been searching all avenues of support for 3 days but still can't get it working. Can someone help, please?
Thanks!