Question

I am following Azure's basic tutorial on Java API here: https://www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/#CreateTable

But encountered the following error:

cannot find symbol

symbol : method createTableIfNotExists(java.lang.String)

location: class com.microsoft.windowsazure.services.table.client.CloudTableClient

The small program in its entirety (copied from Azure tutorial):

import com.microsoft.windowsazure.services.core.storage.*;
import com.microsoft.windowsazure.services.table.client.*;
import com.microsoft.windowsazure.services.table.client.TableQuery.*;

public class AzureTableWrite {
  public static void main(String[] args) {
    // Define the connection-string with your values
    final String storageConnectionString =
        "DefaultEndpointsProtocol=http;" +
        "AccountName=skivvy;" +
        "AccountKey=foobar";

    // Retrieve storage account from connection-string
    CloudStorageAccount storageAccount =
        CloudStorageAccount.parse(storageConnectionString);

    // Create the table client.
    CloudTableClient tableClient = storageAccount.createCloudTableClient();

    // Create the table if it doesn't exist.
    String tableName = "people";
    tableClient.createTableIfNotExists(tableName);
  }
}

Has anybody encountered the same problem? Any help is appreciated!

Was it helpful?

Solution

As mentioned in my response on MSDN Forums (http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/78c12f97-4209-41a1-86d6-267f5e9f51f6), it seems there's an issue with the example you're using.

Please use this instead:

    CloudTableClient tableClient = storageAccount.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("people");
    table.createIfNotExist();

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top