on 11-07-2011 6:47 AM
Dear All,
Just I am trying to connect HANA server through OLDEB connection in VB6, getting error following error when excute SQL statement.
OLEDB Conntion is successed
error at SQL statment Excution time
Error Screenshot : http://goo.gl/SrdBO
Code :
Sub hana_connection()
Dim CONN As ADODB.Connection
Dim comm As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim StrSql As String
Set CONN = New ADODB.Connection
StrSql = "Provider=SAPNewDBMDXProvider.1;Data Source=192.168.99.129;"
StrSql = StrSql & " User ID=system;Password=Passw0rd;Extended Properties='SFC_INSTANCE_NUM=79';"
StrSql = StrSql & "Database=EFASHION_TUTORIAL;Mode=Read|Write"
CONN.Open StrSql
'CONN.CursorLocation = adUseClient
With comm
.ActiveConnection = CONN
.CommandText = "select * from EFASHION_TUTORIAL.OUTLET_LOOKUP"
.CommandType = adCmdText
End With
With rs
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open comm
End With
End Sub
any one tested it? SAP is supported HANA trhough OLEDB?
HANA studio supports JDBC Connection, so what about OLEDB for Microsoft platform
kindly help on this
My main intention is to develop Excel add on like bulk data insert
Thanks & Regards
Rao
Edited by: Ganesh on Nov 7, 2011 3:11 PM
Hello Ganesh,
I think you have the wrong syntax for the connection. Either use CONN.ConnectionString = StrSql and CONN.Open without parameters. Or you CONN.Open with the DSN as a parameter. See http://msdn.microsoft.com/en-us/library/ms807027.aspx for examples.
Regards,
Marc
SAP Customer Solution Adoption (CSA)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
solved,
So now oledb connections are two types
1. oledb provider ( for access attribute views)
2. odbc driver ( can access tables )
when i try to access oledb models then following connection
StrSql = "Provider=SAPNewDBMDXProvider.1;Data Source=192.168.99.129;"
StrSql = StrSql & " User ID=system;Password=Passw0rd;Extended Properties='SFC_INSTANCE_NUM=79';"
StrSql = StrSql & "Database=EFASHION_TUTORIAL;Mode=Read|Write"
when i try to connect tables following connection string ( for accessing tables use folloiw connection string )
StrSql = "SERVERNODE={192.168.99.129:37915};DSN=HAN2;UID=system;PWD=Passw0rd;"
remain VB vcode are same
CONN.Open StrSql
CONN.Execute "SELECT TOP 1000 * FROM EFASHION_TUTORIAL.OUTLET_LOOKUP"
I hope above is useful for who was write addon on excel using scripts
thanks
Rao
Hello guys,
I develope today for SAP IT and I have try to connect in OLEDB to HANA DB from Visual Basic .NET.
I have configured my ODBC client and I can contact my SCHEMA.
I have configured my VB.net application by using one ODBC connection and it works.
Now when I try to connect from OLEDB I can open the connection but when I execute a request I have the following error :
"sql processing error: Error processing MDX command: Attempt to set function flag on non-function object ([Select Statement])"
My source code :
string strsql2 = "Provider=SAPNewDBMDXProvider.1;Data Source=MYHANASERVEUR.par.sap.corp;User ID=system;Password=MyPass;Persist Security Info=True;Impersonation Level=Anonymous;Mode=ReadWrite;Protection Level=None;Extended Properties=\"SFC_INSTANCE_NUM=00;SFC_LOG_ENABLED=0;SFC_LOG_FILENAME=SimbaProvider.log;SFC_SQLDBC_TRACE_ENABLED=0;SFC_SSL_ENABLED=0;SFC_SSL_SELFSIGNED=0;SFC_SSL_VALIDATE=0;\";Initial Catalog=championsleague";
StringBuilder sb = new StringBuilder();
string sqlSelect = @"select * from CL.CL_TEAMNAMES_UEFA";
DataSet myDataSet = new DataSet();
OleDbConnection myAccessConn = null;
try
{
myAccessConn = new OleDbConnection(strsql2);
}
catch (Exception ex)
{
Console.WriteLine("Error: Failed to create a database connection. \n{0}", ex.Message);
return;
}
try
{
OleDbCommand myAccessCommand = new OleDbCommand(test4, myAccessConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
myAccessConn.Open();
myAccessCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine("Error: Failed to retrieve the required data from the DataBase.\n{0}", ex.Message);
return;
}
finally
{
myAccessConn.Close();
}
}
}
Could you please help me with this issue ?
Best regards,
Yann
Hi,
My CT wants to know how to connect to SAP HANA using OLEDB in Excel Macro VBA.
We could't find any good sample source code for reference, and if you experienced it, could you share it?
Below codes are ADODB sources which can access to SAP HANA in Excel Macro VBA.
----------------------------------------------------------------------
Dim CONN As Object 'ADODB.Connection
Dim rs As Object 'ADODB.RecordSet
Dim StrSql As String
Set CONN = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
StrSql = "SERVERNODE={xxx.xxx.xx.xxx:30015};DSN=HAN;UID=USER53;PWD=Sxxxx;"
CONN.Open StrSql
Set rs = CONN.Execute("SELECT * FROM TEST00")
data = rs.GetRows()
MsgBox data(0, 0)
----------------------------------------------------------------------
Hello,
OLEDB is supported - please check Master guide (page :30 - chapter 3.5 Configuring End-User Clients)
https://service.sap.com/~sapidb/011000358700000604552011
On pages 32-33 you can see that OLEDB was used to connect Excel.
However I do not know how it is with script support.
Tomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.