Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JDBC-ODBC dbase connection error

4 views
Skip to first unread message

Christian Thayer

unread,
Nov 18, 1996, 3:00:00 AM11/18/96
to

I would like to connect to my dBase database with JDBC and Sun's
JDBC-ODBC Bridge.

When I try to start the programm (attached at the end of this post) I
get the following error message:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Name der
Datenquelle nicht gefunden und kein Standardtreiber angegeben
(translation: Name of date source not found and no standard data
source defined)

at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:3647)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:3800)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:1015)
at
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:1
32)
at
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:152)
at java.sql.DriverManager.getConnection(DriverManager.java:95)
at
java.sql.DriverManager.getConnection(DriverManager.java:137)
at Sample.open(Sample.java:23)
at Sample.main(Sample.java:14)


As an ODBC Native Driver I use the the one provided by Visual Dbase
5.5 which can be accessed through the IDAPI directory (path is set to
c:\idapi). When starting the BDECFG configuration programm I have
found a driver named DBASE which is already set up and tried to add my
own odbc dbase driver.

I changed the entries of dsn to several options but always received
the same error message.

Any help on how to solve this problem?

Thank you in advance.

Christian

Here is the java programm:

/*
Java JDBC Test mit einer dbase Datei
*/

import java.sql.*;

class Sample {

static Connection con;

public static void main (String args[]) throws Exception {

Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
open ();
select ();
close();
}

static void open () throws SQLException {
String dsn = "jdbc:odbc:TYR95";
String user = "guest";
String password = "guestpass";
con = DriverManager.getConnection (dsn,user,password);
con.setAutoCommit(false);
}

static void close () throws SQLException {

con.commit();
con.close();
}

static void select() throws SQLException {

String query = "SELECT FAM_NAME FROM TYR95";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

boolean more = rs.next();

if (!more) {
System.out.println ("No rows found.");
}

while (more) {
System.out.println("Nachname:
"+rs.getString("Fam_Name"));
System.out.println("");
more = rs.next();
}

rs.close();
stmt.close();
}
}

Christian Thayer

unread,
Nov 19, 1996, 3:00:00 AM11/19/96
to

h895...@asterix.wu-wien.ac.at (Christian Thayer) wrote:

I apologise for not specifying the platform this question was about,
it is Windows95.

Thank you for the hints sent to me by email. Thereby I found out that
I mistook the idapi programm shipped with my visual dbase 5.5 copy as
the right setup tool for odbc.

As I added a dBase driver with Tyr95 as the data source name
everything worked out fine (or more straight forward I should better
have written "dBASE-Dateien" as the DSN as I found out later).

So the right setup for odbc on Windows 95 can be done in the control
panel (Systemsteuerung) / 32-Bit ODBC.

Christian

0 new messages