How can a connection to a datasource, which is NOT registerd in the DatabaseContext be created?
/* get the service manager */
xContext = UNO.connect()
xMcf = xContext~getServiceManager
/* retrieve the DriverManager and get its XDriverManager interface */
xDriverManager = xMcf~createInstanceWithContext(-
"{%see com.sun.star.sdbc.DriverManager}",xContext)~{%see com.sun.star.sdbc.XDriverManager%XDriverManager}
/* first create the database URL */
url = "jdbc:mysql://localhost:3306/test"
/* create property values for user and password */
props = bsf.createArray(.UNO~propertyValue,3)
props[1] = .UNO~PropertyValue~new
props[1]~Name = "user"
props[1]~Value = "stefan"
props[2] = .UNO~PropertyValue~new
props[2]~Name = "password"
props[2]~Value = "apple"
props[3] = .UNO~PropertyValue~new
props[3]~Name = "JavaDriverClass"
props[3]~Value = "com.mysql.jdbc.Driver"
/* create the connection to mysql */
xConnection = xDriverManager~getConnectionWithInfo(url, props)
say "Connection created by the DriverManager!"
/* get the XClosable interface and close the connection */
xCloseable = xConnection~{%see com.sun.star.sdbc.XCloseable%XCloseable}~close
say "Connection closed!"
::requires UNO.cls -- get UNO support