[
http://jira.nuxeo.org/browse/NXP-2093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34114#action_34114
]
Florent Guillaume commented on NXP-2093:
----------------------------------------
For reference the following unit test was used to test the drivers. This
assumes a table created (like Jena does) with:
CREATE TABLE jena_graph (
ID INT NOT NULL PRIMARY KEY IDENTITY(1,1),
Name NVARCHAR(1024)
)
package test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import junit.framework.TestCase;
public class MSSQLTest extends TestCase {
public Connection con;
@Override
public void setUp() throws Exception {
//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Class.forName("net.sourceforge.jtds.jdbc.Driver");
//String url =
"jdbc:sqlserver://172.16.245.128:1433;database=Nuxeo;user=sa;password=nuxeo;";
String url =
"jdbc:jtds:sqlserver://172.16.245.128:1433/Nuxeo;user=sa;password=nuxeo;";
con = DriverManager.getConnection(url);
}
@Override
public void tearDown() throws Exception {
if (con != null) {
con.close();
}
}
public void testAsJena() throws Exception {
String s = "INSERT INTO jena_graph (Name) VALUES (?) \n SELECT
@@IDENTITY \n";
PreparedStatement ps = con.prepareStatement(s);
ps.setString(1, "bar1");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Object o = rs.getObject(1);
System.out.println("1 ("+o+')');
}
}
public void testWithTwoStatements() throws Exception {
String s = "INSERT INTO jena_graph (Name) VALUES (?)";
PreparedStatement ps = con.prepareStatement(s);
ps.setString(1, "bar2");
ps.execute();
s = "SELECT @@IDENTITY";
ps = con.prepareStatement(s);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Object o = rs.getObject(1);
System.out.println("2 ("+o+')');
}
}
}
> Make relations work with MS SQL Server
> --------------------------------------
>
> Key: NXP-2093
> URL: http://jira.nuxeo.org/browse/NXP-2093
> Project: Nuxeo Enterprise Platform 5
> Issue Type: New Feature
> Components: Relation Engine
> Affects Versions: 5.1.3.1
> Reporter: Alain Escaffre
> Assignee: Florent Guillaume
> Priority: Critical
> Fix For: 5.1.4
>
>
> The relation engine doesn't work for now when the data source is connected to
> a MS SQL database. Here is the describtion of how to connect to the MS SQL
> database (which was respected when testing)
> http://jena.sourceforge.net/DB/mssql-howto.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets