KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > sql > MockDriver


1 package com.mockobjects.sql;
2
3 import java.sql.*;
4 import java.util.Properties JavaDoc;
5
6 public class MockDriver implements Driver{
7     public static MockDriver myDriver = new MockDriver();
8     private Connection myConnection;
9
10     static{
11         try{
12             DriverManager.registerDriver(myDriver);
13         }catch(SQLException e){
14             e.printStackTrace();
15         }
16     }
17
18     public void setupConnect(Connection aConnection){
19         this.myConnection = aConnection;
20     }
21
22     public boolean acceptsURL(String JavaDoc url){
23         return true;
24     }
25
26     public Connection connect(String JavaDoc url, Properties JavaDoc info){
27         return myConnection;
28     }
29
30     public int getMajorVersion(){
31         return 0;
32     }
33
34     public int getMinorVersion(){
35         return 0;
36     }
37
38     public DriverPropertyInfo[] getPropertyInfo(String JavaDoc url, Properties JavaDoc info){
39         return null;
40     }
41
42     public boolean jdbcCompliant(){
43         return false;
44     }
45 }
46
Popular Tags