我在这里关注Azure的Java API基础教程:https://www.windowsazure.com/en-us/develop/java/how-to-guides/table-service/#CreateTable
但遇到以下错误:
无法找到符号
symbol:方法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);
}
}
有人遇到过同样的问题吗?任何帮助表示赞赏!
答案 0 :(得分: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();
希望这有帮助。