Android & PostgreSQL (application/pdf - 311.5 KB) - PGCon
Android & PostgreSQL (application/pdf - 311.5 KB) - PGCon
Android & PostgreSQL (application/pdf - 311.5 KB) - PGCon
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Open a Database Connection<br />
Load the <strong>PostgreSQL</strong> JDBC driver and open a database connection using SSL:<br />
C l a s s . forName ( ” org . p o s t g r e s q l . D r i v e r ” ) ;<br />
S t r i n g u r l ;<br />
u r l = ” j d b c : p o s t g r e s q l : / / pghost :5432/ pgdatabase ” +<br />
”? s s l f a c t o r y=org . p o s t g r e s q l . s s l . N o n V a l i d a t i n g F a c t o r y ” +<br />
”&s s l=t r u e ” ;<br />
Connection conn = DriverManager . g e t C o n n e c t i o n ( u r l ,<br />
” p g u s e r ” ,<br />
” pgpass ” ) ;<br />
// Don ’ t f o r g e t to c l o s e the c o n n e c t i o n when you ’ r e done .<br />
// conn . c l o s e ( ) ;<br />
markwkm (<strong>PGCon</strong>2011) <strong>Android</strong> & <strong>PostgreSQL</strong> 20 May 2011 10 / 37