Loading ...
Sorry, an error occurred while loading the content.
 

Re: [xml-dbms] Oracle thin driver

Expand Messages
  • Ronald Bourret
    I just got back the results of this program for the Oracle thin driver. What that driver does is not usable. (Part of the problem here is that the JDBC spec
    Message 1 of 3 , Feb 28, 2003
      I just got back the results of this program for the Oracle thin driver.
      What that driver does is not usable. (Part of the problem here is that
      the JDBC spec does not even explain what data type create parameters are
      and the ODBC spec is only marginally better.)

      Could people please run this for their JDBC drivers and post the results
      to the list? If no drivers implement create parameters correctly, I'll
      just override this in XML-DBMS, using the standard SQL parameters.

      Thanks,

      -- Ron

      Ronald Bourret wrote:
      >
      > Is anybody out there using the Oracle thin driver? If so, could you
      > please modify the code at the end of this message to use your driver,
      > database, etc. and tell me what is returned for the params for VARCHAR2?
      >
      > A user not on this list has reported that the Oracle thin driver does
      > not return any create params for VARCHAR2. This causes XML-DBMS to
      > incorrectly construct CREATE TABLE statements. I would like to verify
      > that this is true before I change XML-DBMS's code to work around this.
      >
      > Thanks,
      >
      > -- Ron
      >
      > VARCHAR2 TEST CODE
      > ==================
      > import java.sql.*;
      > import java.io.*;
      >
      > public class dbtest
      > {
      >
      > public static void main (String[] argv)
      > {
      > try
      > {
      > // Get the connection
      >
      > String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
      > String url = "jdbc:odbc:xmldbms";
      > String user = "ron";
      > String password = "password";
      > Class.forName(driver);
      > Connection conn = DriverManager.getConnection(url, user,
      > password);
      >
      > // Get the result set of data type information.
      >
      > DatabaseMetaData meta = conn.getMetaData();
      > ResultSet rs = meta.getTypeInfo();
      > while (rs.next())
      > {
      > // Get the type name, data type indicator, and create
      > parameters.
      >
      > String typeName = rs.getString(1);
      > short type = rs.getShort(2);
      > String params = rs.getString(6);
      > if (rs.wasNull()) params = null;
      >
      > System.out.print("type: " + typeName + " number: " + type +
      > " params: ");
      > if (params == null)
      > {
      > System.out.println("NONE");
      > }
      > else
      > {
      > System.out.println(params);
      > }
      > }
      >
      > // Close the result set.
      >
      > rs.close();
      > conn.close();
      > }
      > catch(Exception e)
      > {
      > e.printStackTrace();
      > }
      > }
      > }
      >
      >
      > To post a message, send it to: xml-dbms@yahoogroups.com
      > To unsubscribe, send a blank message to: xml-dbms-unsubscribe@yahoogroups.com
      > Or join the newsgroup at: news://news.barkto.com/homeless.xml.xml-dbms
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

      --
      Ronald Bourret
      Programming, Writing, and Research
      XML, Databases, and Schemas
      http://www.rpbourret.com
    • Peter Van den Wildenbergh
      bash-2.05b$ java -cp classes12.zip:. dbtest type: NUMBER number: -7 params: (1) type: NUMBER number: -6 params: (3) type: NUMBER number: -5 params: NONE type:
      Message 2 of 3 , Mar 13, 2003
        bash-2.05b$ java -cp classes12.zip:. dbtest
        type: NUMBER number: -7 params: (1)
        type: NUMBER number: -6 params: (3)
        type: NUMBER number: -5 params: NONE
        type: LONG RAW number: -4 params: NONE
        type: RAW number: -3 params: NONE
        type: LONG number: -1 params: NONE
        type: CHAR number: 1 params: NONE
        type: NUMBER number: 2 params: NONE
        type: NUMBER number: 4 params: (10)
        type: NUMBER number: 5 params: (5)
        type: FLOAT number: 6 params: NONE
        type: REAL number: 7 params: NONE
        type: VARCHAR2 number: 12 params: NONE
        type: DATE number: 93 params: NONE
        type: STRUCT number: 2002 params: NONE
        type: ARRAY number: 2003 params: NONE
        type: BLOB number: 2004 params: NONE
        type: CLOB number: 2005 params: NONE
        type: REF number: 2006 params: NONE

        // changed source on 2 lines
        String driver = "oracle.jdbc.driver.OracleDriver";
        String url = "jdbc:oracle:thin:@tai-pan:1521:ikermit";



        --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...> wrote:
        > Is anybody out there using the Oracle thin driver? If so, could you
        > please modify the code at the end of this message to use your driver,
        > database, etc. and tell me what is returned for the params for VARCHAR2?
        >
        > A user not on this list has reported that the Oracle thin driver does
        > not return any create params for VARCHAR2. This causes XML-DBMS to
        > incorrectly construct CREATE TABLE statements. I would like to verify
        > that this is true before I change XML-DBMS's code to work around this.
        >
        > Thanks,
        >
        > -- Ron
        >
        > VARCHAR2 TEST CODE
        > ==================
        > import java.sql.*;
        > import java.io.*;
        >
        > public class dbtest
        > {
        >
        > public static void main (String[] argv)
        > {
        > try
        > {
        > // Get the connection
        >
        > String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        > String url = "jdbc:odbc:xmldbms";
        > String user = "ron";
        > String password = "password";
        > Class.forName(driver);
        > Connection conn = DriverManager.getConnection(url, user,
        > password);
        >
        > // Get the result set of data type information.
        >
        > DatabaseMetaData meta = conn.getMetaData();
        > ResultSet rs = meta.getTypeInfo();
        > while (rs.next())
        > {
        > // Get the type name, data type indicator, and create
        > parameters.
        >
        > String typeName = rs.getString(1);
        > short type = rs.getShort(2);
        > String params = rs.getString(6);
        > if (rs.wasNull()) params = null;
        >
        > System.out.print("type: " + typeName + " number: " + type +
        > " params: ");
        > if (params == null)
        > {
        > System.out.println("NONE");
        > }
        > else
        > {
        > System.out.println(params);
        > }
        > }
        >
        > // Close the result set.
        >
        > rs.close();
        > conn.close();
        > }
        > catch(Exception e)
        > {
        > e.printStackTrace();
        > }
        > }
        > }
      Your message has been successfully submitted and would be delivered to recipients shortly.