1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
// Decompiled by DJ v3.4.4.74 Copyright 2003 Atanas Neshkov Date: 15/04/2010 12:04:38
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: OracleDriver.java
package oracle.jdbc.driver;
import java.sql.*;
import java.util.Hashtable;
import java.util.Properties;
import oracle.jdbc.dbaccess.DBAccess;
import oracle.jdbc.dbaccess.DBError;
// Referenced classes of package oracle.jdbc.driver:
// OracleConnection
public class OracleDriver
implements Driver
{
public OracleDriver()
{
}
public boolean acceptsURL(String s)
{
int i = oracleAcceptsURL(s);
return i != 2 && i != 1;
}
public Connection connect(String s, Properties properties)
throws SQLException
{
if(s.regionMatches(0, "jdbc:default:connection", 0, 23))
{
String s1 = "jdbc:oracle:kprb";
int j = s.length();
if(j > 23)
s = s1.concat(s.substring(23, s.length()));
else
s = s1.concat(":");
s1 = null;
}
int i = oracleAcceptsURL(s);
if(i == 1)
return null;
if(i == 2)
{
DBError.check_error(67, "OracleDriver.connect");
return null;
}
Hashtable hashtable = parse_url(s);
String s2 = properties.getProperty("user");
String s3 = properties.getProperty("password");
String s4 = properties.getProperty("database");
if(s4 == null)
s4 = properties.getProperty("server");
if(s2 == null)
s2 = (String)hashtable.get("user");
if(s3 == null)
s3 = (String)hashtable.get("password");
if(s4 == null)
s4 = (String)hashtable.get("database");
String s5 = (String)hashtable.get("protocol");
properties.put("protocol", s5);
if(s5 == null)
DBError.check_error(40, "OracleDriver.parse_url");
String s6 = (String)protocols.get(s5);
if(s6 == null)
DBError.check_error(40, "OracleDriver.parse_url");
String s7 = properties.getProperty("dll");
if(s7 == null)
properties.put("dll", "ocijdbc8");
String s8 = properties.getProperty("prefetch");
if(s8 == null)
s8 = properties.getProperty("rowPrefetch");
if(s8 == null)
s8 = properties.getProperty("defaultRowPrefetch");
if(s8 != null && Integer.parseInt(s8) <= 0)
s8 = null;
String s9 = properties.getProperty("batch");
if(s9 == null)
s9 = properties.getProperty("executeBatch");
if(s9 == null)
s9 = properties.getProperty("defaultExecuteBatch");
if(s9 != null && Integer.parseInt(s9) <= 0)
s9 = null;
String s10 = properties.getProperty("remarks");
if(s10 == null)
s10 = properties.getProperty("remarksReporting");
String s11 = properties.getProperty("synonyms");
if(s11 == null)
s11 = properties.getProperty("includeSynonyms");
DBAccess dbaccess = null;
try
{
dbaccess = (DBAccess)Class.forName(s6).newInstance();
}
catch(Exception _ex)
{
return null;
}
Connection connection = getConnectionInstance(dbaccess, s, s2, s3, s4, properties);
if(s8 != null)
((OracleConnection)connection).setDefaultRowPrefetch(Integer.parseInt(s8));
if(s9 != null)
((OracleConnection)connection).setDefaultExecuteBatch(Integer.parseInt(s9));
if(s10 != null)
((OracleConnection)connection).setRemarksReporting(s10.equalsIgnoreCase("true"));
if(s11 != null)
((OracleConnection)connection).setIncludeSynonyms(s11.equalsIgnoreCase("true"));
hashtable = null;
return connection;
}
public Connection defaultConnection()
throws SQLException
{
if(m_defaultConn == null || m_defaultConn.isClosed())
m_defaultConn = DriverManager.getConnection("jdbc:oracle:kprb:");
return m_defaultConn;
}
Connection getConnectionInstance(DBAccess dbaccess, String s, String s1, String s2, String s3, Properties properties)
throws SQLException
{
return new OracleConnection(dbaccess, s, s1, s2, s3, properties);
}
public int getMajorVersion()
{
return 1;
}
public int getMinorVersion()
{
return 0;
}
public DriverPropertyInfo[] getPropertyInfo(String s, Properties properties)
throws SQLException
{
return new DriverPropertyInfo[0];
}
public boolean jdbcCompliant()
{
return true;
}
private int oracleAcceptsURL(String s)
{
int i = s.indexOf(':');
if(i == -1)
return 1;
int j = s.indexOf(':', i + 1);
if(j == -1)
return 1;
if(!s.regionMatches(true, i + 1, "oracle", 0, j - (i + 1)))
return 1;
int k = s.indexOf(':', j + 1);
if(k == -1)
return 2;
String s1 = s.substring(j + 1, k);
return !s1.equals("oci8") && !s1.equals("thin") && !s1.equals("kprb") && !s1.equals("dnldthin") ? 2 : 3;
}
Hashtable parse_url(String s)
throws SQLException
{
Hashtable hashtable = new Hashtable(5);
int i = s.indexOf(':', s.indexOf(':') + 1) + 1;
int j = s.length();
if(i == j)
return hashtable;
int k = s.indexOf(':', i);
if(k == -1)
return hashtable;
hashtable.put("protocol", s.substring(i, k));
int l = k + 1;
int i1 = s.indexOf('/', l);
int j1 = s.indexOf('@', l);
if(j1 == -1)
j1 = j;
if(i1 == -1)
i1 = j1;
if(l < i1)
hashtable.put("user", s.substring(l, i1));
if(i1 < j1)
hashtable.put("password", s.substring(i1 + 1, j1));
if(j1 < j)
hashtable.put("database", s.substring(j1 + 1));
return hashtable;
}
public static final char slash_character = 47;
public static final char at_sign_character = 64;
static final String oracle_string = "oracle";
static final String user_string = "user";
static final String password_string = "password";
static final String database_string = "database";
static final String server_string = "server";
static final String access_string = "access";
public static final String protocol_string = "protocol";
public static final String dll_string = "dll";
public static final String logon_as_internal_str = "internal_logon";
static final String prefetch_string = "prefetch";
static final String row_prefetch_string = "rowPrefetch";
static final String default_row_prefetch_string = "defaultRowPrefetch";
static final String batch_string = "batch";
static final String execute_batch_string = "executeBatch";
static final String default_execute_batch_string = "defaultExecuteBatch";
static final String remarks_string = "remarks";
static final String report_remarks_string = "remarksReporting";
private static final String synonyms_string = "synonyms";
private static final String include_synonyms_string = "includeSynonyms";
static Properties protocols;
protected static Connection m_defaultConn = null;
private static OracleDriver m_defaultDrvr;
private static final int ACCEPTS_URL_GEN_ERROR = 1;
private static final int ACCEPTS_URL_ORACLE_ERROR = 2;
private static final int ACCEPTS_URL_SUCCESS = 3;
static
{
m_defaultDrvr = null;
protocols = new Properties();
protocols.put("thin", "oracle.jdbc.ttc7.TTC7Protocol");
protocols.put("dnldthin", "oracle.jdbc.dnldttc7.TTC7Protocol");
protocols.put("oci8", "oracle.jdbc.oci8.OCIDBAccess");
protocols.put("kprb", "oracle.jdbc.kprb.KprbDBAccess");
protocols.put("3Tthin", "oracle.jdbc.corba.client.Access");
protocols.put("dnld3Tthin", "oracle.jdbc.dnldcorba.client.Access");
try
{
if(m_defaultDrvr == null)
{
m_defaultDrvr = new OracleDriver();
DriverManager.registerDriver(m_defaultDrvr);
}
}
catch(RuntimeException _ex) { }
catch(SQLException _ex) { }
}
} |
Partager