Skip to main content

Posts

Showing posts with the label JDBC

configuration for JDBC

Go to: administrative tools-> ODBC-> User DSN -> Add to which you want to connect, select an option like MySql ODBC driver. Data Source name: name of db. server: localhost user: root click on test. It'll notify if the connection is established or not.

JDBC

sample code for JDBC: class connect { ResultSet rs; Statement stmt; connect() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:temp",username,password); stmt=con.createStatement(); String query; ResultSet rs = stmt.executeQuery(query); } in query always append "+". e.g.: "insert into debit values ("+mob_no+","+amount+")"