// Here are some sample values to be stored: var intval1 = 1000, intval2 = 2000; var stringval1 = "Alice"; var stringval2 = "Bob"; // Take the URL, the DBUSER and DBPASS from the database.properties config file var JDBC_URL = "jdbc:oracle:thin:@oracle.server.example.com:1521/stages"; var DBUSER = "STAGES"; var DBPASS = "SECRET"; var connection = java.sql.DriverManager.getConnection(JDBC_URL, DBUSER, DBPASS); // This is the SQL statement to insert data into a "cust_stages_export" table with // four rows, i1, i2, s1, s2 with integer and varchar types. // The table needs to already exist! var insert = "INSERT INTO cust_stages_export ( i1, i2, s1, s2 ) VALUES ( ?, ?, ?, ? )"; try { var statement = connection.prepareStatement(insert); try { // This pushes the data into the statement replacing the '?' values: statement.setInt(1, intval1); statement.setInt(2, intval2); statement.setString(3, stringval1); statement.setString(4, stringval2); // And then execute the insert statement.executeUpdate(); } finally { try { statement.close(); } catch (e) { // } } } finally { connection.close(); }