# QSqlDatabase Class Reference

### [com.trolltech.qt.sql package]

### Constructor

- void QSqlDatabase()
- void QSqlDatabase(QSqlDatabase other)

### Constructor Properties

- prototype: The QSqlDatabase prototype object
- QSqlDatabase addDatabase(QSqlDriver driver, String connectionName)
- QSqlDatabase cloneDatabase(QSqlDatabase other, String connectionName)
- List connectionNames()
- bool contains(String connectionName)
- QSqlDatabase database(String connectionName, bool open)
- List drivers()
- bool isDriverAvailable(String name)
- void registerSqlDriver(String name, QSqlDriverCreatorBase creator)
- void removeDatabase(String connectionName)

### Prototype Object Properties

- void close()
- bool commit()
- String connectOptions()
- String connectionName()
- String databaseName()
- QSqlDriver driver()
- String driverName()
- QSqlQuery exec(String query)
- String hostName()
- bool isOpen()
- bool isOpenError()
- bool isValid()
- QSqlError lastError()
- NumericalPrecisionPolicy numericalPrecisionPolicy()
- bool open()
- String password()
- int port()
- QSqlIndex primaryIndex(String tablename)
- QSqlRecord record(String tablename)
- bool rollback()
- void setConnectOptions(String options)
- void setDatabaseName(String name)
- void setHostName(String host)
- void setNumericalPrecisionPolicy(NumericalPrecisionPolicy precisionPolicy)
- void setPassword(String password)
- void setPort(int p)
- void setUserName(String name)
- List tables(TableType type)
- bool transaction()
- String userName()

### Instance Properties

QSqlDatabase objects have no special properties beyond those inherited from the QSqlDatabase prototype object.