Thread: jdbc driver: Why it isn't jdbcCompliant?
Hi! I'm using Sun JDK 1.2.2 and tried to use the pgsql interface with postgresql 6.x and 7.0 as well. I couldn't use any of the interfaces because the method Driver.jdbcCompliant() is always false. Even with mysql driver. I used a little test program: if (evt.getSource()==registerButton) { try { Driver d=(Driver)Class.forName(driver.getText()).newInstance(); kiir("Registered driver: "+driver.getText()); kiir("Verzio:"+d.getMajorVersion()+"."+d.getMinorVersion()); String s; if (!d.jdbcCompliant()) s=" not"; else s=" "; kiir("This driver is "+s+"JDBC-compliant"); } catch (Exception e) { hiba("Registrationfailed", e); } where driver.Gettext is the path of the postgres driver (org.postgres.Driver i think.) Thanx for your help Greg.
Janossy Gergely <gjano@freemail.hu> writes: > Hi! > > I'm using Sun JDK 1.2.2 and tried to use the pgsql interface with postgresql > 6.x and 7.0 as well. I couldn't use any of the interfaces because > the method Driver.jdbcCompliant() is always false. Even with mysql driver. Hi Janossy, I guess this only means that the driver doesn't implement all the interfaces according to the JDBC specification. But it works fine for most applications as long you not are depending on esoteric(or special) features. In fact I'm very satisfied with it for an JDBC based web application I ported this week to PostgreSQL. I'm also running Sun JDK 1.2.2 as you do. regards, Gunnar
Joseph Shraibman <jks@selectacast.net> writes: Yes - your point being ? I think that you will find that most JDBC drivers out there do not implement the spec. to the letter. But using good OO design principles and adapters you can easily use a subset of the spec(plus your favorite non SQL 92 database extensions) together with appropriate adaptors to keep things fairly easy to port between databases. The four databases that I know best Sybase ASE, PosgreSQL, Progress V9.1 and MySQL do not fully implement the JDBC spec. But then again I think SQL 92 is the same story... Regards, Gunnar > >From the Driver source code: > public boolean jdbcCompliant() > { > return false; > }
I wasn't making a point. I was just including the comment from the source code to tell why jdbcCompliant() returns false, namely that postgresql isn't sql 92 compliant. Gunnar R|nning wrote: > > Joseph Shraibman <jks@selectacast.net> writes: > > Yes - your point being ? I think that you will find that most JDBC drivers > out there do not implement the spec. to the letter. But using good OO > design principles and adapters you can easily use a subset of the spec(plus > your favorite non SQL 92 database extensions) together with appropriate > adaptors to keep things fairly easy to port between databases. The four > databases that I know best Sybase ASE, PosgreSQL, Progress V9.1 and MySQL > do not fully implement the JDBC spec. But then again I think SQL 92 is the > same story... > > Regards, > > Gunnar > > > >From the Driver source code: > > > public boolean jdbcCompliant() > > { > > return false; > > }
Gunnar R|nning wrote: > > Janossy Gergely <gjano@freemail.hu> writes: > > > Hi! > > > > I'm using Sun JDK 1.2.2 and tried to use the pgsql interface with postgresql > > 6.x and 7.0 as well. I couldn't use any of the interfaces because > > the method Driver.jdbcCompliant() is always false. Even with mysql driver. > > Hi Janossy, > > I guess this only means that the driver doesn't implement all the > interfaces according to the JDBC specification. But it works fine for most > applications as long you not are depending on esoteric(or special) > features. In fact I'm very satisfied with it for an JDBC based web application > I ported this week to PostgreSQL. I'm also running Sun JDK 1.2.2 as you do. > > regards, > Gunnar From the Driver source code: /** * Report whether the driver is a genuine JDBC compliant driver. A * driver may only report "true" here if it passesthe JDBC compliance * tests, otherwise it is required to return false. JDBC compliance * requires full support forthe JDBC API and full support for SQL 92 * Entry Level. * * <p>For PostgreSQL, this is not yet possible, as we arenot SQL92 * compliant (yet). */ public boolean jdbcCompliant() { return false; }
jdbcCompliant() will always return false as it's hardwired to do so. It does this because we don't yet support the minimum facilities required before we can set it. CallableStatement is one good example. Is it your own code that's requiring it to be set, or someone elses classes? Peter -- Peter Mount Enterprise Support Maidstone Borough Council Any views stated are my own, and not those of Maidstone Borough Council. -----Original Message----- From: Janossy Gergely [mailto:gjano@freemail.hu] Sent: Saturday, May 27, 2000 12:27 AM To: pgsql-interfaces@postgresql.org Subject: [INTERFACES] jdbc driver: Why it isn't jdbcCompliant? Hi! I'm using Sun JDK 1.2.2 and tried to use the pgsql interface with postgresql 6.x and 7.0 as well. I couldn't use any of the interfaces because the method Driver.jdbcCompliant() is always false. Even with mysql driver. I used a little test program: if (evt.getSource()==registerButton) { try { Driver d=(Driver)Class.forName(driver.getText()).newInstance(); kiir("Registered driver: "+driver.getText()); kiir("Verzio:"+d.getMajorVersion()+"."+d.getMinorVersion()); String s; if (!d.jdbcCompliant()) s=" not"; else s=" "; kiir("This driver is "+s+"JDBC-compliant"); } catch (Exception e) { hiba("Registrationfailed", e); } where driver.Gettext is the path of the postgres driver (org.postgres.Driver i think.) Thanx for your help Greg.
I think the comment in thr source needs to be updated, as it's not that accurate now. There's two sides to the problem, the main one is that we don't yet fully support all the necessary methods required for compliancy (which is what the tests check). Also CallableStatement has never been implemented (it's just a stub at the moment), and were only just starting on implementing the ODBC style escape syntax. The SQL92 reference is so that simple queries can be written, and they will work for all compliant drivers without changing the calling code. Peter -- Peter Mount Enterprise Support Maidstone Borough Council Any views stated are my own, and not those of Maidstone Borough Council. -----Original Message----- From: Joseph Shraibman [mailto:jks@selectacast.net] Sent: Tuesday, May 30, 2000 3:36 AM To: Gunnar R|nning Cc: Janossy Gergely; pgsql-interfaces@postgresql.org Subject: Re: [INTERFACES] jdbc driver: Why it isn't jdbcCompliant? I wasn't making a point. I was just including the comment from the source code to tell why jdbcCompliant() returns false, namely that postgresql isn't sql 92 compliant. Gunnar R|nning wrote: > > Joseph Shraibman <jks@selectacast.net> writes: > > Yes - your point being ? I think that you will find that most JDBC drivers > out there do not implement the spec. to the letter. But using good OO > design principles and adapters you can easily use a subset of the spec(plus > your favorite non SQL 92 database extensions) together with appropriate > adaptors to keep things fairly easy to port between databases. The four > databases that I know best Sybase ASE, PosgreSQL, Progress V9.1 and MySQL > do not fully implement the JDBC spec. But then again I think SQL 92 is the > same story... > > Regards, > > Gunnar > > > >From the Driver source code: > > > public boolean jdbcCompliant() > > { > > return false; > > }