cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a HANA Database?

Former Member
0 Kudos

Hi All,

I am trying to test the speed of a HANA database by creating a table and loading some data onto it and do some ah-hoc SQL against it.

Since I am new to HANA, I read the developer guide, registered for the free 1G account, downloaded the HANA Studio and using the HANA Cloud Platform Cockpit, all trying to create a table in a database and so far failed.

It seems from the Cockpit, I already have a HANA instance named dev, also there this a dev Schema created already.  The question is how I can create my table within the Cockpit?  Also how do I hook up the HANA Studio to my trial account?

Appreciate any helps!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Mr.Kin Ng,

if you would like to connect your sap hana cloud platform with sap hana studio, you should follow this link:

http://scn.sap.com/community/developer-center/cloud-platform/blog/2013/07/16/using-hana-modeler-in-s...

for creating table in SAP HANA please take care of the following:

1- create a schema and save it as (MYSCHEMA.hdbschema)

Example:

schema_name="MYSCHEMA";

2- then create a table and save as (table.hdbtable)

Example:

table.schemaName = "MYSCHEMA";

table.tableType = COLUMNSTORE ;

table.description = "my first table";

table.columns = [

{name = "orderID" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "OrderItem" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "ProductId" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "Quantity" ;sqlType = NVARCHAR ;nullable = false ;length = 5 ;},

{name = "QuantityUnit" ;sqlType = NVARCHAR ;nullable = false ;length = 5;}

];

table.primaryKey.pkcolumns = ["orderID"];

then you will get your table created>>

enjoy with SAP HANA

best regards,

Murhaf Khaled

Former Member
0 Kudos

Hi Murhaf,

I have trouble following even the 1st step.

Can you tell me which tool to use to create a schema?  I will very much hope I can do with the Cockpit  using the web browser.  Sorry since I am new and probably didn't know a lot of the concepts, a step by step instruction would be very helpful.  For example, in your step 1, you said "create a schema", in my mind, it could mean using X tool, clicking X option, then type in the text, or using windows Notepad and type in a text and then upload somewhere.

Thanks

Kin

Former Member
0 Kudos

Dear Mr.Kin Ng,

If you would like to create a database using SAP HANA Cloud Platform Cockpit, you should do the following:

1- you should have an account on for cloud platform by using this link https://account.hanatrial.ondemand.com for free account

or this link https://account.hana.ondemand.com for production usage

2- then after you log on, you should go to HANA Instances and then create a new instance.

3- after creating SAP HANA instance, you will see something called "Development Tools" and beside it there is a "SAP HANA Web-based Development Workbench". please press on that link.

4- you will get something like this:

5- now you need to create your own sub-package by doing right click on the package that named like your created instance and name the sub-package like "workshop1"

6- then right click on "workshop1" and select create Application and then do the following:

7- then right click on the "workshop1" and select create package and name it as "data"

8- the right click on the "data" package and select create file and name it as "MYSCHEMA.hdbschema"

9- open the created file and type the following:

for example:

schema_name="MYSCHEMA";


10- the right click on the "data" package and select create file and name it as "table.hdbtable"

11- open the created file and type the following:

for example:

table.schemaName = "MYSCHEMA";

table.tableType = COLUMNSTORE ;

table.description = "my first table";

table.columns = [

{name = "orderID" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "OrderItem" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "ProductId" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},

{name = "Quantity" ;sqlType = NVARCHAR ;nullable = false ;length = 5 ;},

{name = "QuantityUnit" ;sqlType = NVARCHAR ;nullable = false ;length = 5;}

];

table.primaryKey.pkcolumns = ["orderID"];

best regards,

Murhaf Khaled

Former Member
0 Kudos

Hi Murhaf,

Thank you very much for the detailed step by step!  I would not have figured that out on my own.  I have followed the steps and but still got a few more questions...

1) In the Cockpit and clicking on "HANA Instances", there is no option for me to create an instance but there is an existing instance already and it's called dev.  I think we are fine here.

2) Now that I have created a schema and table files, like below

Have I actually created the schema and table yet or I simply created 2 text files containing the scripts for creating a schema and a table within the schema and still require "running" the scripts?  If so, how can I "run" the scripts?

3) How can I insert data into the table and then do a "select * from mytable" against the table?

Sorry my background is Oracle so I tend to use it as a reference.

Thanks

Kin