1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27#ifndef __com_sun_star_sdbc_XDriver_idl__ 28#define __com_sun_star_sdbc_XDriver_idl__ 29 30#ifndef __com_sun_star_uno_XInterface_idl__ 31#include <com/sun/star/uno/XInterface.idl> 32#endif 33 34#ifndef __com_sun_star_beans_PropertyValue_idl__ 35#include <com/sun/star/beans/PropertyValue.idl> 36#endif 37 38#ifndef __com_sun_star_sdbc_SQLException_idl__ 39#include <com/sun/star/sdbc/SQLException.idl> 40#endif 41 42#ifndef __com_sun_star_sdbc_DriverPropertyInfo_idl__ 43#include <com/sun/star/sdbc/DriverPropertyInfo.idl> 44#endif 45 46 module com { module sun { module star { module sdbc { 47 48 published interface XConnection; 49 published interface XDriverManager; 50 51 52/** is the interface that every driver class must implement. 53 54 55 56 <p> 57 Each driver should supply a service that implements 58 the Driver interface. 59 60 </p> 61 <p>The DriverManager will try to load as many drivers as it can 62 find, and then for any given connection request, it will ask each 63 driver in turn to try to connect to the target URL. 64 65 </p> 66 <p> 67 It is strongly recommended that each Driver object should be 68 small and standalone so that the Driver object can be loaded and 69 queried without bringing in vast quantities of supporting code. 70 71 </p> 72 @see com::sun::star::sdbc::XDriverManager 73 @see com::sun::star::sdbc::XConnection 74 */ 75published interface XDriver: com::sun::star::uno::XInterface 76{ 77 78 /** attempts to make a database connection to the given URL. 79 The driver should return 80 <NULL/> 81 if it realizes it is the wrong kind 82 of driver to connect to the given URL. This will be common, as when 83 the driver manager is asked to connect to a given URL it passes 84 the URL to each loaded driver in turn. 85 86 87 88 <p> 89 The driver should raise a 90 <type scope="com::sun::star::sdbc">SQLException</type> 91 if it is the right 92 driver to connect to the given URL, but has trouble connecting to 93 the database. 94 95 </p> 96 <p> 97 The info argument can be used to pass arbitrary 98 string tag/value pairs as connection arguments. 99 Normally at least "user" and "password" properties should be 100 included in the Properties. For a JDBC driver also the Java class must 101 be supplied in the property named JavaDriverClass, and a class path (a 102 space-separated list of URLs) needed to locate that class can optionally 103 be supplied in a property named JavaDriverClassPath. 104 Possible property value names are when supported by the driver: 105 @see com::sun::star::sdbc::ConnectionProperties 106 </p> 107 108 @param url 109 is the URL of the database to which to connect. 110 @param info 111 a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included. 112 @see com::sun::star::sdbc::ConnectionProperties 113 @returns 114 a Connection object that represents a connection to the URL 115 @throws SQLException 116 if a database access error occurs 117 118 */ 119 XConnection connect( 120 [in]string url, 121 [in]sequence<com::sun::star::beans::PropertyValue> info) 122 raises (SQLException); 123 //------------------------------------------------------------------------- 124 125 /** returns <TRUE/> if the driver thinks that it can open a connection 126 to the given URL. Typically drivers will return <TRUE/> if they 127 understand the subprotocol specified in the URL and <FALSE/> if 128 they do not. 129 130 @param url 131 is the URL of the database to which to connect. 132 @returns 133 <TRUE/> if this driver can connect to the given URL. 134 @throws SQLException 135 if a database access error occurs. 136 */ 137 boolean acceptsURL([in]string url) raises (SQLException); 138 //------------------------------------------------------------------------- 139 140 /** gets information about the possible properties for this driver. 141 <p>The getPropertyInfo method is intended to allow a generic GUI tool to 142 discover what properties it should prompt a human for in order to get 143 enough information to connect to a database. Note that depending on 144 the values the human has supplied so far, additional values may become 145 necessary, so it may be necessary to iterate though several calls 146 to getPropertyInfo. 147 @param url 148 is the URL of the database to which to connect. 149 @param info 150 is a proposed list of tag/value pairs that will be sent on 151 connect open. 152 @returns 153 an array of DriverPropertyInfo objects describing possible 154 properties. This array may be an empty array if no properties 155 are required. 156 @throws SQLException 157 if a database access error occurs. 158 */ 159 sequence<DriverPropertyInfo> getPropertyInfo([in]string url, 160 [in] sequence<com::sun::star::beans::PropertyValue> info) 161 raises (SQLException); 162 //------------------------------------------------------------------------- 163 164 /** gets the driver's major version number. Initially this should be 1. 165 @returns 166 this driver's major version number 167 */ 168 long getMajorVersion(); 169 //------------------------------------------------------------------------- 170 171 /** gets the driver's minor version number. Initially this should be 0. 172 @returns 173 this driver's minor version number. 174 */ 175 long getMinorVersion(); 176}; 177 178//============================================================================= 179 180}; }; }; }; 181 182#endif 183