users@glassfish.java.net

Class name is wrong or classpath is not set

From: <glassfish_at_javadesktop.org>
Date: Fri, 10 Jul 2009 10:35:11 PDT

Hi, i'm newbe in JDBC and i need somehelp here if it is possible.

I m using [b]netbeans 6.5.1[/b] with [b]glassfish v2[/b] server

The error showing is ::: [b]Class name is wrong or classpath is not set for : com.microsoft.sql.jdbcx.sqlserver.SQLServerDataSource[/b]

i get this error when i run the servlet file , and this appears in the browser window

Sun resource shows ::
---------------------------------------------------
[b]<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/myDatasource" object-type="user" pool-name="connectionPool">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.microsoft.sql.jdbcx.sqlserver.SQLServerDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="connectionPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="URL" value="jdbc:sun:sqlserver://server_name[:portNumber];databaseName=database;selectMethod=cursor"/>
<property name="User" value="sa"/>
<property name="Password" value="niit"/>
<property name="databaseName" value="mydb1"/>
<property name="serverName" value="PCV"/>
<property name="portNumber" value="1437"/>
</jdbc-connection-pool>
</resources>[/b]
----------------------------------

And the servlet file is ::
-----------------------------------
[b]package sp;

import java.io.;
*import javax.servlet.;
*import java.sql.;
*import javax.naming.;
*import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

public class servlet2 extends HttpServlet {

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet servlet2</title>");
out.println("</head>");
out.println("<body>");
try{
DataSource ds = null;
Context myc = new InitialContext();
ds = (DataSource) myc.lookup("jdbc/myDatasource");
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select prod_id from mytable1");
while(rs.next()){
out.println(rs.getString(1)"<BR>");
}
}
catch(Exception e){
out.println("THE ERROR IS : " e);
}
out.println("</body>");
out.println("</html>");

} finally {
out.close();
}
}[/b]
--------------------------------------------

could anyone please help me
i can mail the whole project if needed
[Message sent by forum member 'siddhantmahajan' (siddhantmahajan)]

http://forums.java.net/jive/thread.jspa?messageID=355157