| Author |
Can't connect to Access database using Cloudscape
|
Jodie Anderson
Greenhorn
Joined: Feb 08, 2002
Posts: 2
|
|
Hi I have the following code: import java.sql.*; public class Exercise2_1 { static String driver = "COM.cloudscape.core.JDBCDriver"; static String url = "jdbc:cloudscape:c:/j2sdkee1.3/cloudscape/test2"; public static void main(String[] args) { try{ Class.forName(driver).newInstance(); System.out.println("Loaded driver"); Connection conn = DriverManager.getConnection(url); System.out.println("Connected to database"); conn.close(); System.out.println("Closed connection"); } catch(Throwable e) {System.err.println(e.getMessage());} } } The driver loads fine. However, I get an error message saying "Can't find database" (the Access database does exist in the given directory above!) Is the fact that it is an Access db an issue? If so, how can I resolve this issue? Any info would be great, as I am at a loss here! Thanks in advance!
|
 |
Sean Richards
Greenhorn
Joined: Feb 02, 2002
Posts: 8
|
|
In order to connect to an Access database you must first set up the DSN in ODBC. Then you must use the appropriate driver for Access. You cannot connect to an access database using a cloudscape driver. the right driver to use is String driver = "Sun.jdbc.odbc.JdbcOdbcDriver" String url = "jdbc dbc SNNAME" The DSNNAME is the name you choose to use for your database. Hope this helps.
|
 |
 |
|
|
subject: Can't connect to Access database using Cloudscape
|
|
|