aspose file tools
The moose likes JDBC and the fly likes Can't connect to Access database using Cloudscape Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Can Watch "Can New topic
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can't connect to Access database using Cloudscape
 
Similar Threads
Remote Exception in EJB with MySQL
Database program major issues.
Is my javaBean a javaBean?
how to connect MS Access directly
Establishing Connection to MS Access Databases