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