| 21 | } // end of constructor |
| 22 | |
| 23 | @Override |
| 24 | public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { |
| 25 | int rc = 0; |
| 26 | String url = parms[1]; |
| 27 | DataSource ds = null; |
| 28 | PoolingDataSource pds = null; |
| 29 | |
| 30 | if (DEBUG) |
| 31 | System.out.println("Connecting to Postgresql data source"); |
| 32 | |
| 33 | try { |
| 34 | CheckURL(url, "postgresql"); |
| 35 | |
| 36 | if ((ds = dst.get(url)) == null) { |
| 37 | pds = new PoolingDataSource(); |
| 38 | pds.setUrl(url); |
| 39 | |
| 40 | if (parms[2] != null) |
| 41 | pds.setUser(parms[2]); |
| 42 | |
| 43 | if (parms[3] != null) |
| 44 | pds.setPassword(parms[3]); |
| 45 | |
| 46 | ds = pds; |
| 47 | |
| 48 | dst.put(url, ds); |
| 49 | } // endif ds |
| 50 | |
| 51 | // Get a connection from the data source |
| 52 | conn = ds.getConnection(); |
| 53 | |
| 54 | // Get the data base meta data object |
| 55 | dbmd = conn.getMetaData(); |
| 56 | |
| 57 | // Get a statement from the connection |
| 58 | stmt = GetStmt(fsize, scrollable); |
| 59 | } catch (SQLException se) { |
| 60 | SetErrmsg(se); |
| 61 | rc = -2; |
| 62 | } catch( Exception e ) { |
| 63 | SetErrmsg(e); |
| 64 | rc = -3; |
| 65 | } // end try/catch |
| 66 | |
| 67 | return rc; |
| 68 | } // end of JdbcConnect |
| 69 | |
| 70 | } // end of class PostgresqlInterface |