JDBC connectivity with microsoft access giveing a problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rajendra_Sherikar
Posted On:   Sunday, July 13, 2003 03:14 PM

I am using the following code to connect to microsoft access on xp using odbc. But it keeps giving me an SQL Exception saying "No Suitable driver found" package examples.texteditor.Database; import java.sql.* ; import java.util.Properties; /** * * @author Rajendra Sherikar */ public class MakingTheconnection { public static void main(String[] args) { String driverName = "sun.jdbc.odbc.JdbcOdbcDriver"; String sourceURL = "jdbc.odbc:technical_library" ; //System.setProperty("jdbc.drivers","sun.jdbc.odbc.JdbcOdceDriver"); //System.getProperties().list(System.out);    More>>

I am using the following code to connect to microsoft access on xp using odbc. But it keeps giving me an SQL Exception saying "No Suitable driver found"


package examples.texteditor.Database;
import java.sql.* ;
import java.util.Properties;
/**
*
* @author Rajendra Sherikar
*/
public class MakingTheconnection

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

String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String sourceURL = "jdbc.odbc:technical_library" ;


//System.setProperty("jdbc.drivers","sun.jdbc.odbc.JdbcOdceDriver");
//System.getProperties().list(System.out);


// Load the driver
try
{
// Load the driver class
Class.forName(driverName);
Properties prop = new Properties();
prop.setProperty("user", "rsherikar");
prop.setProperty("password", "shrarush");

//Define the data sources for the driver

//String sourceURL = "jdbc:odbc:technical_library";

//Create a connection through the DriverManager


Connection databaseConnection =
DriverManager.getConnection(sourceURL,prop);

}

catch(ClassNotFoundException cnfe)
{
System.err.println("Error loading " +driverName);
}

catch(SQLException sqle)
{
System.err.println(sqle);
}


}
}

   <<Less

Re: JDBC connectivity with microsoft access giveing a problem

Posted By:   Justin_Jensen  
Posted On:   Wednesday, July 16, 2003 04:55 PM


your source url is wrong... you have a period where you should have a :



ex.



String sourceURL = "jdbc:odbc:technical_library";



Hope this helps
About | Sitemap | Contact