1 21 22 package org.apache.derby.jdbc; 23 24 import java.sql.DriverManager ; 25 import java.sql.Driver ; 26 import java.sql.Connection ; 27 import java.sql.DriverPropertyInfo ; 28 import java.sql.SQLException ; 29 30 import java.io.PrintStream ; 31 import java.util.Properties ; 32 33 import org.apache.derby.iapi.reference.MessageId; 34 import org.apache.derby.iapi.reference.Attribute; 35 import org.apache.derby.iapi.services.i18n.MessageService; 36 import org.apache.derby.iapi.jdbc.JDBCBoot; 37 38 39 92 93 public class EmbeddedDriver implements Driver { 94 95 static { 96 97 EmbeddedDriver.boot(); 98 } 99 100 private AutoloadedDriver _autoloadedDriver; 101 102 public EmbeddedDriver() { 106 EmbeddedDriver.boot(); 107 } 108 109 112 117 public boolean acceptsURL(String url) throws SQLException { 118 return getDriverModule().acceptsURL(url); 119 } 120 121 126 public Connection connect(String url, Properties info) 127 throws SQLException 128 { 129 return getDriverModule().connect(url, info); 130 } 131 132 137 public DriverPropertyInfo [] getPropertyInfo(String url, Properties info) 138 throws SQLException 139 { 140 return getDriverModule().getPropertyInfo(url, info); 141 } 142 143 147 public int getMajorVersion() { 148 try { 149 return (getDriverModule().getMajorVersion()); 150 } 151 catch (SQLException se) { 152 return 0; 153 } 154 } 155 156 160 public int getMinorVersion() { 161 try { 162 return (getDriverModule().getMinorVersion()); 163 } 164 catch (SQLException se) { 165 return 0; 166 } 167 } 168 169 173 public boolean jdbcCompliant() { 174 try { 175 return (getDriverModule().jdbcCompliant()); 176 } 177 catch (SQLException se) { 178 return false; 179 } 180 } 181 182 185 private Driver getDriverModule() 186 throws SQLException 187 { 188 return AutoloadedDriver.getDriverModule(); 189 } 190 191 192 196 static void boot() { 197 PrintStream ps = DriverManager.getLogStream(); 198 199 if (ps == null) 200 ps = System.err; 201 202 new JDBCBoot().boot(Attribute.PROTOCOL, ps); 203 } 204 205 206 207 } 208 | Popular Tags |