Sunday, June 5, 2011

example, we're connecting to a local Interbase server

JDBC connection to an Interbase database. In this example, we're connecting to a local Interbase server using the JDBC ODBC bridge driver after setting up Interbase as an ODBC datasource on the local system.
// Establish a connection to an Interbase database using JDBC and ODBC.
import java.sql.*;

class JdbcTest1
{
public static void main (String[] args)
{
try
{
// Step 1: Load the JDBC ODBC driver.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Step 2: Establish the connection to the database.
String url = "jdbc:odbc:contact_mgr";
Connection conn = DriverManager.getConnection(url,"user1","password");
}
catch (Exception e)
{
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}

No comments:

Post a Comment

 
THANK YOU FOR VISITING