Technically I know this is a java question,
but hey thought I'd throw it out here,

I have a jsp file that is calling a bean to connect to MS SQL 2000,

<jsp:useBean id="select" class="DataBaseSelect3" scope="request">
</jsp:useBean>

<% out.print(select.connect()); %>
<br>
<% out.print(select.select()); %>

<p>Format results

<br>
<%@ page import="java.util.Vector" %>
<% Vector aResult = select.getResult(); %>

<table>
<% for (int i=0; i < aResult.size(); i++) { %>
   <tr>
       <td>
           <% out.print(aResult.elementAt(i)); %>
       </td>
   </tr>
<% } %>

then inside the bean which is called DataBase3.class I am calling a
netDirect JDBC driver,
I'm getting this error,

Error Message:
Driver is now Loaded! 
SQLException:No suitable driver 
Format results 

// here is the .java code,

import java.sql.*;
import java.util.Vector;

/**
 * DataBaseSelect.java
 * Written by Morgan Catlin
 *   August 19, 1999
 * 
 * Variables:
 *   Vector result = where I put the results of a select query
 * 
 * Methods:
 *   Vector getResult() = returns result
 *   void setResult() = sets result
 *   String connect() = connects to a database
 *   String select() = selects information from a database
 */



public class DataBaseSelect3 {
   
   private Vector result;
     
   public DataBaseSelect3() {
      result = new Vector();
   } // constructor DataBaseSelect
   
   public String connect() {
      try {
         Class.forName("com.jnetdirect.jsql.JSQLDriver").newInstance();

         return "Driver is now Loaded!";
      } catch (Exception E) {
         return "SQLException:" + E.getMessage();
      }
   }
   
   public String select() {
      try {
         Connection C =
DriverManager.getConnection("jdbc:JSQLConnect://devserver/conn?DSN=seanmccar
rick;Database=SeanMcCarrick;uid=sa;pwd=");
         
         Statement Stmt = C.createStatement();
         
         ResultSet myResult = Stmt.executeQuery("SELECT UserName from
Login");
         
         while (myResult.next()) {
            result.addElement(myResult.getString(1));

         }
         
         // Clean up
         myResult.close();
         Stmt.close();
         C.close();
         return "Connection Success!";
      } catch (SQLException E) {
         return "SQLException2:" + E.getMessage();
      }
   }
      
   /**
    * Accessor for result
    **/
   public Vector getResult() {
      return result;
   }
   
   /**
    * Mutator for result
    **/
   public void setResult(Vector avector) {
     result = avector;
   }  
   
} // class DataBaseSelect

any help is greatly appreciated,
Respectfully,

J
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to