我使用以下化学CMIS代码连接到Alfresco
public static string connetionString= "Data Source=localhost;Database=agility;userid=root;password='';";
public void SomeMethod()
{
using(MySqlConnection conn = new MySqlConnection(connetionString));
{
conn.Open();
string query = @"INSERT INTO GARA
(nome_gara, giudice, località, data, tpsopm, tpmopm, tpstot, tpmtot)
VALUES
(@Param1, @Param2, @Param3, @Param4, @Param5, @Param6, @Param7, @Param8)";
MySqlCommand cmd = new MySqlCommand(@"query", conn);
cmd.Parameters.AddWithValue("@Param1", textBox1.Text);
cmd.Parameters.AddWithValue("@Param2", textBox2.Text);
cmd.Parameters.AddWithValue("@Param3", textBox3.Text);
cmd.Parameters.AddWithValue("@Param4", textBox4.Text);
cmd.Parameters.AddWithValue("@Param5", textBox5.Text);
cmd.Parameters.AddWithValue("@Param6", textBox6.Text);
cmd.Parameters.AddWithValue("@Param7", textBox7.Text);
cmd.Parameters.AddWithValue("@Param8", textBox8.Text);
cmd.ExecuteNonQuery();
}
}
我正在使用
final SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
// prepare connection parameters
final Map<String, String> connectionParameters = new HashMap<String, String>();
// User credentials.
connectionParameters.put(SessionParameter.USER,"******");
connectionParameters.put(SessionParameter.PASSWORD,"*****");
// Connection settings.
connectionParameters.put(SessionParameter.ATOMPUB_URL,"https://******/alfresco/api/-default-/public/cmis/versions/1.1/atom");
connectionParameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
connectionParameters.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
session = sessionFactory.getRepositories(connectionParameters).get(0).createSession();
连接到它但得到以下错误
<dependency>
<groupId>org.apache.chemistry.opencmis</groupId>
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>1.0.0</version>
</dependency>
请帮忙。
答案 0 :(得分:0)
问题是由于AWS中安装了不稳定的露天。当Alfresco正确重新安装时,上面的代码工作正常。