Donnerstag, 8. Januar 2009

Java SQL

java.sql.*

connecting to Driver Interface
try {
class.forName("com.mysql.jdbc.Driver").newInstance();
} catch ( Exception e) { ... }

Connection cn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=bla&password=bla");

SQLException ex;
ex.getMessage().ex_getSQLState()
ex.getErrorCode()

Statement st = cn.createStatement();
ResultSet rs = st.executeQuery("SELECT ...");

if( st.execute("SELECT ..."))
rs = st.getResultSet();


rs.close(); st.close();




Keine Kommentare:

Kommentar veröffentlichen