com.sap.db.jdbc.Driver ngdbc-2.4.59.jar SAPHANA数据库驱动

通俊发
2023-12-01

由于CSDN恶心的改版,免费的资源被自动设置积分下载,决定把资源通过百度云共享,如果链接失效回复,楼主会进行更新。

https://pan.baidu.com/s/1IAgTsaqnElPYzqhXti9uig

附上调用带返回值的SAP Hana调用存储过程的sample。

package conn;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;

public class HanaConnTest {

	private String DRIVER = "com.sap.db.jdbc.Driver";
	private String URL = "jdbc:sap://11.56.100.88:31015?reconnect=true";

	public Connection getConnection(String driver, String url, String user, String password) throws Exception {
		Class.forName(driver);
		return DriverManager.getConnection(url, user, password);
	}

	public static void main(String[] args) {
		HanaConnTest connTest = new HanaConnTest();
		try {
			Connection connect = connTest.getConnection(connTest.DRIVER, connTest.URL, "username", "password");
			CallableStatement c=connect.prepareCall("call \"database\".\"存储过程名字\"(?,?,?,?)"); //一个?一个参数,这个存储过程两个输入,两个输出
			c.setString(1, "parameter1");
			c.setString(2, "parameter1");
			c.registerOutParameter(3, java.sql.Types.INTEGER);   //output1
			c.registerOutParameter(4, java.sql.Types.INTEGER);   //output2
			c.execute();
			System.out.println(c.getString(3));
			System.out.println(c.getString(4));
			
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

 类似资料: