Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jdbc connectivity

Status
Not open for further replies.

cdon

Programmer
Jul 5, 2003
17
GB
Hi,

I have been given the following code but I get an error stating difficulties in connecting to the database.

Please excuse my ignorance but what is lochport? Should this not be the name of the database I wish to connect to? The database I wish to connect to is called kirky.mdb

Many thanks for any help received.


public void Connection()
{
java.lang.String s = "jdbc:eek:dbc:lochport";
java.lang.String s1 = "";
java.lang.String s2 = "";
try
{
java.lang.Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.Exception exception)
{
java.lang.System.out.println("Failed to load JDBC/ODBC driver.");
return;
}
try
{
m_Con = java.sql.DriverManager.getConnection(s, s1, s2);
m_Stmt = m_Con.createStatement();
}
catch(java.lang.Exception exception1)
{
java.lang.System.err.println("problems connecting to " + s);
}
}
 
'lochport' should be name of the datasource that's defined in the window ODBC Database Source Adminsitrator which points to your kirky.mdb.
 
Thanks very much. Thats solved it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top