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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect java to my sql database

Status
Not open for further replies.

jimwal0367

Programmer
Dec 3, 2005
24
GB
Not sure if this is the right forum, I need to connect to my sql database using java. I cannot seem to get the jdbc drivers to load. Does anybody have any ideas, here is the code so far.


// Establish a connection to an Interbase database using JDBC.
import java.sql.*;


class DbConnect {

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

// Step 1: Load the JDBC driver.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

// Step 2: Establish the connection to the database.
String url = "Server Name";
Connection conn = DriverManager.getConnection(url,"user1","password");

} catch (Exception e) {
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}

jimwal0367
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top