lina-: Access Verbindung herstellen

Beitrag lesen

moin chris :)

Versuchs mal mit dem Code von diesem Servlet-Tutorial:

  
Connection con = null;  
try {  
  // Load (and therefore register) the JDBC-ODBC Bridge  
  // Might throw a ClassNotFoundException  
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  
  
  // Get a connection to the database  
  // Might throw an SQLException  
  con = DriverManager.getConnection("jdbc:odbc:somedb", "user", "passwd");  
  
  // The rest of the code goes here.  
}  
catch (ClassNotFoundException e) {  
  // Handle an error loading the driver  
}  
catch (SQLException e) {  
  // Handle an error getting the connection  
}  
finally {  
  // Close the Connection to release the database resources immediately.  
  try {  
    if (con != null) con.close();  
  }  
  catch (SQLException ignored) { }  
}  

liebe Grüße aus Berlin
lina-

--
Dinge aus dem linaland
Self-Code: ie:% fl:( br:^ va:) ls:/ fo:| rl:( ss:) de:] js:| mo:)