Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Main {
- public static void main(String[] argv) {
- try {
- String url = "jdbc:sap://sapbipoc:30015/";
- String user="POC_USER";
- String password = "Pa22w0rd";
- Connection connection =
- DriverManager.getConnection(url,user,password);
- if (connection != null) {
- System.out.println("Connection to SAP HANA successful!");
- Statement stmt = connection.createStatement();
- ResultSet resultSet = stmt.executeQuery("select * from
- POC_USER.TEMPFORECASTS");
- while(resultSet.next()){
- System.out.println(resultSet.getString(1));
- }
- }else{
- System.out.println("Connection error!");}
- } catch (Exception ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- import java.sql.*;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Main {
- public static void main(String[] argv) {
- try {
- String url = "jdbc:sap://172.8.162.10:30015/?databaseName=PQ0";
- String user="rgonzalezp";
- String password = "SomePassword";
- Connection connection =
- DriverManager.getConnection(url,user,password);
- if (connection != null) {
- System.out.println("Connection to SAP HANA successful!");
- Statement stmt = connection.createStatement();
- ResultSet resultSet = stmt.executeQuery("Select top 10 * from
- CHI_SUP.BRAND");
- while(resultSet.next()){
- System.out.println(resultSet.getString(1));
- }
- }else{
- System.out.println("Connection error!");}
- } catch (Exception ex) {
- Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
Add Comment
Please, Sign In to add comment