Sunday, September 28, 2014

How to Connect to ODB Java

Instructions

    1

    Open your Java programming software and the desktop project you want to edit. Double-click the data connections source code file to load it in the Java editor.

    2

    Add the connection drivers for the SQL language. You need these drivers to query the server. Add the following code to the top of your file:

    import java.sql.Connection;

    3

    Create the connection string variables. The following code sets up the strings you use with the connection libraries:

    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

    String url = "jdbc:odbc:northwind";

    String username = user"";

    String password = "pass";

    Replace the "user" and "pass" values with your username and password.

    4

    Create the connection object:

    Connection connect = new Connection(url, username, password);



No comments:

Post a Comment