Commit c7023bde by Eli Ben Baruch

test SAP HANA db client

for build.gradle:    testCompile fileTree(dir: '../ds/lib/external/sap', include: '*.jar')
parent 4b0482e7
Showing with 36 additions and 0 deletions
package hanaSap;
import org.junit.Test;
import java.sql.*;
/**
* Created by eli on 9/7/16.
*/
public class TestHana {
@Test
public void testHana(){
Connection connection = null;
try {
connection = DriverManager.getConnection(
// "jdbc:sap://52.57.71.173:3015/?autocommit=false","david.horn@ipgallery.com","Ad323056");
"jdbc:sap://52.57.71.173:30015/?autocommit=false","SYSTEM","Welcome1");
} catch (SQLException e) {
System.err.println("Connection Failed. User/Passwd Error?");
return;
}
if (connection != null) {
try {
System.out.println("Connection to HANA successful!");
Statement stmt = connection.createStatement();
ResultSet resultSet = stmt.executeQuery("Select 'hello world' from dummy");
resultSet.next();
String hello = resultSet.getString(1);
System.out.println(hello);
} catch (SQLException e) {
System.err.println("Query failed!");
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment