I am now in hour 6 of attempting to configure a single JNDI DataSouce resouce to connect to an MSSQL database, with Tomcat 6.0.16 (jre 1.6.0_04, windows xp sp3).
I'll skip the gory details, the point I am at now: 1. I have META-INF/context.xml with the resource parameters (I've included this file at the end of this message). 2. I have Microsoft's MSSQL driver JAR, sqljdbc.jar, in WEB-INF/lib but I'm not sure where the correct location for it is. 3. I am receiving the following exception when attempting to open a connection: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' I have Googled a-plenty for this error and found many, many posts about it. Most of the "solutions" were not correct. The solutions that did work for the original posters have not been working for me. I am not sure what I am doing wrong. Here is a bit of the Java code I am using to test this (in a JSP page): InitialContext ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/mssql"); Connection conn = ds.getConnection(); PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM usertest"); It is ds.getConnection() that is throwing the exception. I know that my context.xml file is being loaded by Tomcat because ctx.lookup() succeeds (and fails if I modify context.xml to define a different resource name, which I did as a sanity check). One question I have is, where should the driver JAR go? I have seen multiple references to placing it in Tomcat's "common/lib" directory. I am not sure where that is. There is no directory named "common" in my Tomcat installation. Also, does documentation for this (setting up DataSources in general, and MSSQL specifically) exist? I mean good, concise documentation, not chapters upon chapters of generic JNDI setup information that, even when you've read through all of it, still leaves you hanging with questions like "great... so.... where do I specify the database host name?". Another example of frustrating documentation is the first Google result for "tomcat datasource tutorial" is this page: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html Which describes 5.5, not 6.0, and an MSSQL section is conspicuously absent. I'd really appreciate the help. I have some really aggressive deadlines coming up, and I've spent an unacceptable amount of time trying to do nothing more than configure a database connection, with nothing to show for it. It's getting pretty frustrating. I realize that this may be a question that is commonly asked by many people, based on what I've seen on the internet. I really have spent a lot of time searching for information before posting here, nothing seems to be working out. Here is my context.xml file, it is pieced together from various examples and information I've found on the internet, I have no idea if it's correct or not (apparently not, as it's not working). As far the actual values: I arbitrarily picked "url" instead of "driverName", but in many examples I saw "driverName" being used for the same thing -- also, some examples have "jdbc:microsoft:sqlserver", others just have "jdbc:sqlserver": <?xml version="1.0" encoding="UTF-8"?> <Context path="/TestServlet" docBase="TestServlet" debug="5" reloadable="true" crossContext="true"> <Resource name="jdbc/mssql" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/mssql"> <parameter> <name>maxWait</name> <value>15000</value> </parameter> <parameter> <name>password</name> <value>*password*</value> </parameter> <parameter> <name>url</name> <value>jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=Cursor;DatabaseName=testdb</value> </parameter> <parameter> <name>driverClassName</name> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> </parameter> <parameter> <name>maxIdle</name> <value>2</value> </parameter> <parameter> <name>username</name> <value>*username*</value> </parameter> </ResourceParams> </Context> Thanks a lot, Jason --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]