[ngdbc-2.5.52.jar ]
import java.sql.*;
/**
* @author XR
* @date 2021/11/1 10:57
*/
public class JDBCDemoHANA {
public static String connectionString = "jdbc:sap://192.168.32.134:39013";
public static String user = "REPOUSER";
public static String password = "Xing1234";
public static void main(String[] args) {
Connection connection = null;
try {
connection = DriverManager.getConnection(connectionString, user, password);
} catch (SQLException e) {
System.err.println("Connection Failed. User/Passwd Error? Message: " + e.getMessage());
return;
}
if (connection != null) {
try {
System.out.println("Connection to HANA successful!");
Statement stmt = connection.createStatement();
ResultSet resultSet = stmt.executeQuery("SELECT * FROM HOTEL.HOTEL");
while(resultSet.next()) {
String matnr = resultSet.getString(1);
System.out.println(matnr);
}
} catch (SQLException e) {
System.err.println("Query failed!");
}
}
}
}