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