Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
45b5cd9d
Kaydet (Commit)
45b5cd9d
authored
Şub 03, 2011
tarafından
Mathias Bauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
CWS gnumake3: resync to m99
üst
cd4102b0
e10427dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
34 deletions
+8
-34
CodeSamples.java
odk/examples/DevelopersGuide/Database/CodeSamples.java
+8
-34
No files found.
odk/examples/DevelopersGuide/Database/CodeSamples.java
Dosyayı görüntüle @
45b5cd9d
...
@@ -139,33 +139,6 @@ public class CodeSamples
...
@@ -139,33 +139,6 @@ public class CodeSamples
// uses the driver manager to create a new connection and dispose it.
// uses the driver manager to create a new connection and dispose it.
public
static
XConnection
openConnectionWithDriverManager
()
throws
com
.
sun
.
star
.
uno
.
Exception
public
static
XConnection
openConnectionWithDriverManager
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
XConnection
con
=
null
;
// create the DriverManager
Object
driverManager
=
xMCF
.
createInstanceWithContext
(
"com.sun.star.sdbc.DriverManager"
,
xContext
);
// query for the interface
com
.
sun
.
star
.
sdbc
.
XDriverManager
xDriverManager
;
xDriverManager
=
(
XDriverManager
)
UnoRuntime
.
queryInterface
(
XDriverManager
.
class
,
driverManager
);
if
(
xDriverManager
!=
null
)
{
// first create the needed url
String
adabasURL
=
"sdbc:adabas::MYDB0"
;
// second create the necessary properties
com
.
sun
.
star
.
beans
.
PropertyValue
[]
adabasProps
=
new
com
.
sun
.
star
.
beans
.
PropertyValue
[]
{
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"user"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"password"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
)
};
// now create a connection to adabas
con
=
xDriverManager
.
getConnectionWithInfo
(
adabasURL
,
adabasProps
);
}
return
con
;
}
// uses the driver manager to create a new connection and dispose it.
public
static
XConnection
openToJDBC
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
{
XConnection
con
=
null
;
XConnection
con
=
null
;
// create the DriverManager
// create the DriverManager
...
@@ -186,7 +159,7 @@ public class CodeSamples
...
@@ -186,7 +159,7 @@ public class CodeSamples
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"password"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"password"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"JavaDriverClass"
,
0
,
"org.gjt.mm.mysql.Driver"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
)
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"JavaDriverClass"
,
0
,
"org.gjt.mm.mysql.Driver"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
)
};
};
// now create a connection to
adabas
// now create a connection to
mysql
con
=
xDriverManager
.
getConnectionWithInfo
(
url
,
props
);
con
=
xDriverManager
.
getConnectionWithInfo
(
url
,
props
);
}
}
return
con
;
return
con
;
...
@@ -198,7 +171,7 @@ public class CodeSamples
...
@@ -198,7 +171,7 @@ public class CodeSamples
XConnection
con
=
null
;
XConnection
con
=
null
;
// create the Driver with the implementation name
// create the Driver with the implementation name
Object
aDriver
=
Object
aDriver
=
xMCF
.
createInstanceWithContext
(
"
com.sun.star.comp.sdbcx.adabas.O
Driver"
,
xMCF
.
createInstanceWithContext
(
"
org.openoffice.comp.drivers.MySQL.
Driver"
,
xContext
);
xContext
);
// query for the interface
// query for the interface
com
.
sun
.
star
.
sdbc
.
XDriver
xDriver
;
com
.
sun
.
star
.
sdbc
.
XDriver
xDriver
;
...
@@ -206,15 +179,16 @@ public class CodeSamples
...
@@ -206,15 +179,16 @@ public class CodeSamples
if
(
xDriver
!=
null
)
if
(
xDriver
!=
null
)
{
{
// first create the needed url
// first create the needed url
String
adabasURL
=
"sdbc:adabas::MYDB0
"
;
String
url
=
"jdbc:mysql://localhost:3306/TestTables
"
;
// second create the necessary properties
// second create the necessary properties
com
.
sun
.
star
.
beans
.
PropertyValue
[]
adabasP
rops
=
new
com
.
sun
.
star
.
beans
.
PropertyValue
[]
com
.
sun
.
star
.
beans
.
PropertyValue
[]
p
rops
=
new
com
.
sun
.
star
.
beans
.
PropertyValue
[]
{
{
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"user"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"user"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"password"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
)
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"password"
,
0
,
"test1"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
),
new
com
.
sun
.
star
.
beans
.
PropertyValue
(
"JavaDriverClass"
,
0
,
"org.gjt.mm.mysql.Driver"
,
com
.
sun
.
star
.
beans
.
PropertyState
.
DIRECT_VALUE
)
};
};
// now create a connection to
adabas
// now create a connection to
mysql
con
=
xDriver
.
connect
(
adabasURL
,
adabasP
rops
);
con
=
xDriver
.
connect
(
url
,
p
rops
);
}
}
return
con
;
return
con
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment