2012-10-01 33 views
2

我下面Azure的基於Java API此基礎教程:https://www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/#CreateTableAzure的表存儲:無法創建一個表,一個CloudTableClient實例

但遇到了以下錯誤:

cannot find symbol

symbol : method createTableIfNotExists(java.lang.String)

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

小程序(從Azure教程複製):

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); 
    } 
} 

有沒有人遇到同樣的問題?任何幫助表示讚賞!

回答

3

正如我在MSDN論壇(http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/78c12f97-4209-41a1-86d6-267f5e9f51f6)上的回覆中所述,似乎有一個問題與你正在使用的例子。

請改用此:

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

希望這有助於。

+0

非常感謝您的快速回答。它的工作原理!你在哪裏訪問API文檔?我相信我需要看看其他課程。 –

+0

我只是看了GitHub上提供的源代碼。剛剛在這裏找到了API文檔:http://dl.windowsazure.com/javadoc/。 HTH。 –

+0

這又是非常有用的!感謝一羣Gaurav! –

相關問題