Mercurial > hg > monetdb-java
comparison tests/JDBC_API_Tester.java @ 951:1c4a12a89282
Make JDBC_API_Tester independent of current timezone
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Thu, 16 Jan 2025 12:44:20 +0100 (3 months ago) |
parents | 9c310d692465 |
children | 8aaa9964359a |
comparison
equal
deleted
inserted
replaced
950:52508322a849 | 951:1c4a12a89282 |
---|---|
734 | 734 |
735 private void Test_Driver(String con_URL) { | 735 private void Test_Driver(String con_URL) { |
736 sb.setLength(0); // clear the output log buffer | 736 sb.setLength(0); // clear the output log buffer |
737 | 737 |
738 try { | 738 try { |
739 final Driver driver = DriverManager.getDriver(con_URL); | 739 listDriverProperties(con_URL); |
740 DriverPropertyInfo[] props = driver.getPropertyInfo(con_URL, null); | |
741 DriverPropertyInfo prop; | |
742 final String space = " "; | |
743 for (int i = 0; i < props.length; i++) { | |
744 prop = props[i]; | |
745 sb.append(i).append(space); | |
746 sb.append(prop.name).append(space); | |
747 sb.append(prop.required).append(space); | |
748 sb.append(prop.value).append(space); | |
749 sb.append(prop.description).append("\n"); | |
750 } | |
751 // also test against monetdbs, this should make tls and cert required. | 740 // also test against monetdbs, this should make tls and cert required. |
752 props = driver.getPropertyInfo("jdbc:monetdbs:", null); | |
753 sb.append("getPropertyInfo of jdbc:monetdbs:").append("\n"); | 741 sb.append("getPropertyInfo of jdbc:monetdbs:").append("\n"); |
754 for (int i = 0; i < props.length; i++) { | 742 listDriverProperties("jdbc:monetdbs:"); |
755 prop = props[i]; | |
756 sb.append(i).append(space); | |
757 sb.append(prop.name).append(space); | |
758 sb.append(prop.required).append(space); | |
759 sb.append(prop.value).append(space); | |
760 sb.append(prop.description).append("\n"); | |
761 } | |
762 } catch (SQLException e) { | 743 } catch (SQLException e) { |
763 // this means we get what we expect | 744 // this means we get what we expect |
764 sb.append("failed to get Driver class: ").append(e.getMessage()); | 745 sb.append("failed to get Driver class: ").append(e.getMessage()); |
765 sb.append("\n"); | 746 sb.append("\n"); |
766 } | 747 } |
771 "2 host false IP number, domain name or one of the special values `localhost` and `localhost.`\n" + | 752 "2 host false IP number, domain name or one of the special values `localhost` and `localhost.`\n" + |
772 "3 port false -1 Port to connect to, 1..65535 or -1 for 'not set'\n" + | 753 "3 port false -1 Port to connect to, 1..65535 or -1 for 'not set'\n" + |
773 "4 database false name of database to connect to\n" + | 754 "4 database false name of database to connect to\n" + |
774 "5 autocommit false true initial value of autocommit\n" + | 755 "5 autocommit false true initial value of autocommit\n" + |
775 "6 schema false initial schema\n" + | 756 "6 schema false initial schema\n" + |
776 "7 timezone false 60 client time zone as minutes east of UTC\n" + | 757 "7 timezone false <tz> client time zone as minutes east of UTC\n" + |
777 "8 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" + | 758 "8 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" + |
778 "9 debug false false enable tracing of socket communication for debugging\n" + | 759 "9 debug false false enable tracing of socket communication for debugging\n" + |
779 "10 logfile false when debug is enabled its output will be written to this logfile\n" + | 760 "10 logfile false when debug is enabled its output will be written to this logfile\n" + |
780 "11 so_timeout false 0 abort if network I/O does not complete in this many milliseconds, 0 means no timeout\n" + | 761 "11 so_timeout false 0 abort if network I/O does not complete in this many milliseconds, 0 means no timeout\n" + |
781 "12 treat_clob_as_varchar false true map CLOB/TEXT data to type VARCHAR instead of type CLOB\n" + | 762 "12 treat_clob_as_varchar false true map CLOB/TEXT data to type VARCHAR instead of type CLOB\n" + |
794 "7 certhash false hash of server TLS certificate must start with these hex digits; overrides cert\n" + | 775 "7 certhash false hash of server TLS certificate must start with these hex digits; overrides cert\n" + |
795 "8 clientkey false path to TLS key (+certs) to authenticate with as client\n" + | 776 "8 clientkey false path to TLS key (+certs) to authenticate with as client\n" + |
796 "9 clientcert false path to TLS certs for 'clientkey', if not included there\n" + | 777 "9 clientcert false path to TLS certs for 'clientkey', if not included there\n" + |
797 "10 autocommit false true initial value of autocommit\n" + | 778 "10 autocommit false true initial value of autocommit\n" + |
798 "11 schema false initial schema\n" + | 779 "11 schema false initial schema\n" + |
799 "12 timezone false 60 client time zone as minutes east of UTC\n" + | 780 "12 timezone false <tz> client time zone as minutes east of UTC\n" + |
800 "13 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" + | 781 "13 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" + |
801 "14 debug false false enable tracing of socket communication for debugging\n" + | 782 "14 debug false false enable tracing of socket communication for debugging\n" + |
802 "15 logfile false when debug is enabled its output will be written to this logfile\n" + | 783 "15 logfile false when debug is enabled its output will be written to this logfile\n" + |
803 "16 so_timeout false 0 abort if network I/O does not complete in this many milliseconds, 0 means no timeout\n" + | 784 "16 so_timeout false 0 abort if network I/O does not complete in this many milliseconds, 0 means no timeout\n" + |
804 "17 treat_clob_as_varchar false true map CLOB/TEXT data to type VARCHAR instead of type CLOB\n" + | 785 "17 treat_clob_as_varchar false true map CLOB/TEXT data to type VARCHAR instead of type CLOB\n" + |
805 "18 treat_blob_as_binary false true map BLOB data to type BINARY instead of type BLOB\n" + | 786 "18 treat_blob_as_binary false true map BLOB data to type BINARY instead of type BLOB\n" + |
806 "19 client_info false true whether to send ClientInfo when connecting\n" + | 787 "19 client_info false true whether to send ClientInfo when connecting\n" + |
807 "20 client_application false application name to send in ClientInfo\n" + | 788 "20 client_application false application name to send in ClientInfo\n" + |
808 "21 client_remark false any client remark to send in ClientInfo\n"); | 789 "21 client_remark false any client remark to send in ClientInfo\n"); |
790 } | |
791 | |
792 private void listDriverProperties(String url) throws SQLException { | |
793 final Driver driver = DriverManager.getDriver(url); | |
794 DriverPropertyInfo[] props = driver.getPropertyInfo(url, null); | |
795 for (int i = 0; i < props.length; i++) { | |
796 DriverPropertyInfo prop = props[i]; | |
797 final String name = prop.name; | |
798 String value = prop.value; | |
799 if (name.equals("timezone")) | |
800 value = "<tz>"; | |
801 sb.append(i).append(" "); | |
802 sb.append(name).append(" "); | |
803 sb.append(prop.required).append(" "); | |
804 sb.append(value).append(" "); | |
805 sb.append(prop.description).append("\n"); | |
806 } | |
807 | |
809 } | 808 } |
810 | 809 |
811 private void handleExecuteDDL(Statement stmt, String action, String objtype, String objname, String sql) { | 810 private void handleExecuteDDL(Statement stmt, String action, String objtype, String objname, String sql) { |
812 try { | 811 try { |
813 int response = stmt.executeUpdate(sql); | 812 int response = stmt.executeUpdate(sql); |