To connect a java test application via JDBC/ODBC to a Microsoft ACCESS
database, I use the following three steps.
1. String url = "jdbc:odbc:MYACCESSDATABASE";
2. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
3. con = DriverManager.getConnection(url,"myLogin", "myPassword");
Now I want to connect to a database using another driver category than ODBC.
The information on http://industry.java.sun.com/products/jdbc/drivers says
that a driver for (Borland) Paradox is available. But how can I connect to a
PARADOX database? How about the URL and the correct driver? With or without de
BDE (Borland Database Engine)?
Please send your suggestions/answers to P.B...@gamma.rug.nl
Thank you very much!!!
Regards,
Peter
....
FULL SOURCE CODE OF MY JAVA TEST APPLICATION / ODBC / MS ACCESS:
import java.net.URL;
import java.sql.*;
public class CreateSuppliers {
public static void main(String args[]) {
String url = "jdbc:odbc:MYACCESSDATABASE";
Connection con;
String createString;
createString = "create table SUPPLIERS " +
"(SUP_ID int, " +
"SUP_NAME varchar(40), " +
"STREET varchar(40), " +
"CITY varchar(20), " +
"STATE char(2), ZIP char(5))";
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"myLogin", "myPassword");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " +
ex.getMessage());
}
}
}
it seems to be that Inprise/Borland provides JDBC drivers level 4. I think,
using the level 4 drivers might be the easiest way because these are fully
implemented in Java (thin). I dont know exactly the class structure/names from
Borland driver but it should be similar to the Oracle:
// connect string
String url = "jdbc:oracle:thin:@host:port:dbinstance";
// ^
// vendor
// ^
// type
try
{
// loading the driver
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
_connection = DriverManager.getConnection(url, "TEST", "TEST");
System.out.println("Connection successfully established");
[..]
Maybe this helps,
Harald
--
-----------------------------------------
Sema Group Telecoms
haral...@sema-telecoms.com
Peter Boer <P.B...@gamma.rug.nl> wrote in message
news:93hlnl$t41$1...@info.service.rug.nl...
> Ladies and Gentlemen,
>
> To connect a java test application via JDBC/ODBC to a Microsoft ACCESS
> database, I use the following three steps.
>
> 1. String url = "jdbc:odbc:MYACCESSDATABASE";
> 2. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> 3. con = DriverManager.getConnection(url,"myLogin", "myPassword");
>
> Now I want to connect to a database using another driver category than ODBC.
> The information on http://industry.java.sun.com/products/jdbc/drivers says
> that a driver for (Borland) Paradox is available. But how can I connect to a
> PARADOX database? How about the URL and the correct driver? With or without de
> BDE (Borland Database Engine)?
>
> Please send your suggestions/answers to P.B...@gamma.rug.nl
>
> Thank you very much!!!
>
> Regards,
>
> Peter
[..]