× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: No suitable driver
  • From: "Steve Swett" <swett@xxxxxxxxxxxxxx>
  • Date: Mon, 12 Mar 2001 17:55:53 -0500

Well, in my particular case it was MS SQL Server on NT, and that service
just needed to be started.

However, I just came across another reason you'd get "no suitable driver."

I'm not sure exactly why this was happening, but when I moved my code for
registering the driver (using Class.forName) so that it was in the same
method as the getConnection statement, it worked.  For example, this
sequence of statements works for me.  (Note that this driver is not an
AS/400 driver, but I was getting "no suitable driver" with this code when I
had the first part -- the Class.forName part -- in a different method from
the getConnection part.)

  // Try to load the JData2_0 driver

    try  {
      Driver drv = (Driver)
Class.forName("JData2_0.sql.$Driver").newInstance();
    }

    catch (Exception ec) {
        ec.printStackTrace();
    }


    // Try to connect to the database

    try {
      Connection c =java.sql.DriverManager.getConnection(
        "jdbc:JDataConnect://159.253.62.241/bcsstudent:user:password");

  // Run a query to load a result set:

     // First create an SQL statement:
     Statement s = c.createStatement();

     // Then execute a statement:
     ResultSet rs = s.executeQuery (
       "SELECT STDNAM FROM PAOSSTU WHERE STDCLS = '11' ORDER BY STDNAM");

    // Then loop through ResultSet records to load combo box:
    // For testing for now, just load first student so we don't have to
wait.
    rs.first();
    jComboBox1.addItem(rs.getString("STDNAM"));

    // Close the statement and disconnect:
    s.close();
    c.close();


    }
    catch (Exception ex) {
        ex.printStackTrace();
    }


Hope that helps.

Steve

-----Original Message-----
From: Bartell, Aaron L. (TC) <ALBartell@taylorcorp.com>
To: 'JAVA400-L@midrange.com' <JAVA400-L@midrange.com>
Date: Monday, March 12, 2001 4:55 PM
Subject: RE: No suitable driver


>Steve, what did you do to fix it?
>
>What needs to be running on the server so SQL from a Java pgm can be
>executed?
>
>Aaron Bartell
>
>-----Original Message-----
>From: Steve Swett [mailto:swett@bcswebsite.com]
>Sent: Monday, March 12, 2001 2:38 PM
>To: JAVA400-L@midrange.com
>Subject: Re: No suitable driver
>
>
>I've encountered this when the database service on the server was not
>running; or when the trial version of a database server had expired.
>
>
>-----Original Message-----
>From: Bartell, Aaron L. (TC) <ALBartell@taylorcorp.com>
>To: 'JAVA400-L@midrange.com' <JAVA400-L@midrange.com>
>Date: Monday, March 12, 2001 11:35 AM
>Subject: SQL error codes.
>
>
>>I am getting this error msg when trying to do a simple SELECT on a file.
>>Does this mean that it found the drivers but didn't find one that would be
>>appropriate?  I have looked at the JDBC FAQ and followed what they told me
>>to do concerning the adding of links (ADDLNK), but it still won't work.
>Any
>>suggestions?
>>
>>java.sql.SQLException: No suitable driver
>>
>>Aaron Bartell


+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.