Skip to Content.
Sympa Menu

freetds - error code 08001 accompanied by "java.sql.SQLException: No suitable driver"

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brown, John" <JABrown AT comdt.uscg.mil>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: error code 08001 accompanied by "java.sql.SQLException: No suitable driver"
  • Date: Wed, 18 Apr 2001 21:17:31 -0400


I'm trying to write an applet to connect to a Sysbase Sql Anywhere
Database on an IIs (NT4) server - but so far no luck. Here's the errors I
get:

(error/vendor code) :
"08001"

accompanied by :
"java.sql.SQLException: No suitable driver"

The URL is below:
http://38.144.154.100/legal/applets/test_tds_driver.htm

Any Suggestions are greatly appreciated!

Main Applet Source Code is below:
=======================================
import java.awt.*;
import java.awt.Event;
import java.net.URL;
import java.sql.*;
import java.util.Date;

public class SqlAdmin2 extends java.applet.Applet {
//---strings for connecting to the database
String usersTable=""; // name of the table with users listed in it
String ip="";
String tableStr="";
String thisUsersAccesLevel="";
String thisUsersName="";
String thisUsersPwd="";
String thisUsersID="";
String reportTable="";
String dsnStr="";
String connectStr="";
//---GUI variables and objects
Label StatusLabel=new Label("Enter your SQL query:");
AppTable SessionTable=new AppTable();
TextField sqlText=new TextField(70);
AppTableArea ResultArea=new AppTableArea();
Button clearButton=new Button("clear");
Button executeButton=new Button("execute");
Color blue;
Frame j=new Frame();
//---variable for idendtifying when the DB was updated successfully
boolean updateSuccessful=true;
//---number of records found integer
int totalNumRecs=0;

void buildUI() {

setLayout(new GridLayout(5,4));
GridBagLayout gb=new GridBagLayout();
GridBagConstraints c= new GridBagConstraints();
setLayout(gb);
c.fill=GridBagConstraints.BOTH; // compon.grow in both dimensions
c.insets=new Insets(5,5,5,5); // 5 pixels on each side
c.gridx=0;
c.gridy=0;
c.gridwidth=5;
c.gridheight=1;
c.weightx=0.0;
c.weighty=0.0;
gb.setConstraints(StatusLabel,c);
add(StatusLabel);

c.gridx=0;
c.gridy=1;
c.gridwidth=4;
c.gridheight=1;
c.weightx=0.0;
c.weighty=0.0;
gb.setConstraints(sqlText,c);
add(sqlText);

c.gridx=4;
c.gridy=1;
c.gridwidth=1;
c.gridheight=1;
c.weightx=0.0;
c.weighty=0.0;
gb.setConstraints(executeButton,c);
add(executeButton);

c.gridx=0;
c.gridy=2;
c.gridwidth=5;
c.gridheight=1;
c.weightx=1.0;
c.weighty=1.0;
gb.setConstraints(ResultArea,c);
add(ResultArea);


c.gridx=3;
c.gridy=3;
c.gridwidth=1;
c.gridheight=1;
c.weightx=0.0;
c.weighty=0.0;
gb.setConstraints(clearButton,c);
add(clearButton);

//---set the background color to light blue
blue=new Color(223,255,223);
setBackground(blue);
//---redraw the GUI so everything fits
ResultArea.jb=SessionTable;
ResultArea.resize(620,360);
validate();
} // end for buildUI

public void init() {
ip=getParameter("ip");
dsnStr=getParameter("dsn");
connectStr="jdbc:sybase:tds://"+ip+":uscg";
usersTable=getParameter("usersTable");
reportTable=getParameter("reportTable");
tableStr=getParameter("tableStr");
thisUsersPwd=getParameter("usrPwd");
thisUsersName=getParameter("usrName");
buildUI();


System.out.println("The connection string is:"+connectStr);
} // end of init

void getRecords(String SQL) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("com.internetcds.jdbc.tds.SybaseDriver");
Class.forName("com.internetcds.jdbc.tds.Driver");
} catch (ClassNotFoundException fg) {
StatusLabel.setText("Failed to Load Driver: "+fg.toString());
System.out.println("Failed to Load Driver: "+fg.toString());
}
try {
String url=connectStr;
Connection connection=DriverManager.getConnection(url, null);
Statement statement=connection.createStatement();
int columns=0;
int pos=0;
SessionTable.clear();
String output="";
//execute list function
ResultSet rs = statement.executeQuery(SQL);
ResultSetMetaData md = rs.getMetaData();
columns=rs.getMetaData().getColumnCount();
for (int c=0; c<=columns-1; c++) { // get colnames
SessionTable.add(md.getColumnName(c+1), c,0);
output+=md.getColumnName(c+1)+"\t";
} // end for colname
output+="\n";
//write it to the text area
int x=0;
int y=1;
while (rs.next()) {
for (pos=1;pos<=columns;pos++) {
if (y<SessionTable.maxXItems-2) {
SessionTable.add(rs.getString(pos), x, y);
x++;
}
output+=rs.getString(pos)+"\t";
} // end for
y++; x=0; output+="\n";
} // end while

totalNumRecs=SessionTable.colSize();
StatusLabel.setText("Found "+(totalNumRecs-1)+" records.");
ResultArea.repaint();
} // END OF TRY
catch (SQLException ex)
{
StatusLabel.setText("Couldn't open "+tableStr+":"+ex.toString());
System.out.println(ex.toString());
System.out.println(ex.getErrorCode());
System.out.println(ex.getSQLState());
}
} //----------------------- end of getRecords -----------------------

public boolean action (Event evt, Object arg) { // action handler
if (evt.target instanceof Button) { handleButton((String)arg); }
return true;
} // end of action handler


void handleButton(String s) {
if (s.equals("clear")) { // new session
SessionTable.clear();
validate();
} // end of new session

if (s.equals("execute")) { // options button clicked
getRecords(sqlText.getText());
validate();
} // end for options

} // end of button handling event

} // end of applet




Archive powered by MHonArc 2.6.24.

Top of Page