users@glassfish.java.net

Re: Toplink in Java SE, are there known issues connecting to MS SQL server?

From: <glassfish_at_javadesktop.org>
Date: Thu, 14 Aug 2008 02:05:58 PDT

But there must be a difference, because in the same project, with the same settings, the same classpath, this code works:

    public final void testConnection() {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet res = null;

        String statement = "select * from Table1";

        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:jtds:sqlserver://dbserver.xyz.uvw.de:1433/DATABASENAME", "my_username", "my_password");
            pstmt = con.prepareStatement(statement);
            res = pstmt.executeQuery();

            while (res.next()) {
                System.out.println(counter + ": " + res.getObject(1));
            }
...
[Message sent by forum member 'jiai' (jiai)]

http://forums.java.net/jive/thread.jspa?messageID=293282