Revision 54d2eeaf
Added by Andreas Müller about 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/Source.java | ||
---|---|---|
26 | 26 |
import org.apache.http.MethodNotSupportedException; |
27 | 27 |
import org.apache.log4j.Logger; |
28 | 28 |
|
29 |
import eu.etaxonomy.cdm.common.AccountStore; |
|
29 | 30 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
30 | 31 |
import eu.etaxonomy.cdm.database.update.DatabaseTypeNotSupportedException; |
31 | 32 |
|
... | ... | |
490 | 491 |
} |
491 | 492 |
} |
492 | 493 |
|
494 |
public static void main(String[] arg){ |
|
495 |
Source source = EDAPHOBASE8(); |
|
496 |
ResultSet a = source.getResultSet("SELECT count(*) FROM tax_taxon"); |
|
497 |
try { |
|
498 |
a.next(); |
|
499 |
long size = a.getLong(1); |
|
500 |
} catch (SQLException e) { |
|
501 |
// TODO Auto-generated catch block |
|
502 |
e.printStackTrace(); |
|
503 |
} |
|
504 |
System.exit(0); |
|
505 |
} |
|
506 |
|
|
507 |
private static Source EDAPHOBASE8(){ |
|
508 |
String dbms = Source.POSTGRESQL9; //TODO 10 |
|
509 |
String strServer = "130.133.70.26"; //BGBM-PESISQL |
|
510 |
String strDB = "cdm_edapho"; |
|
511 |
int port = 5432; // 5433; |
|
512 |
String userName = "postgres"; |
|
513 |
return makeSource(dbms, strServer, strDB, port, userName, null); |
|
514 |
} |
|
515 |
|
|
516 |
private static Source makeSource(String dbms, String strServer, String strDB, int port, String userName, String pwd ){ |
|
517 |
//establish connection |
|
518 |
Source source = null; |
|
519 |
source = new Source(dbms, strServer, strDB); |
|
520 |
source.setPort(port); |
|
521 |
|
|
522 |
pwd = AccountStore.readOrStorePassword(dbms, strServer, userName, pwd); |
|
523 |
source.setUserAndPwd(userName, pwd); |
|
524 |
// write pwd to account store |
|
525 |
return source; |
|
526 |
} |
|
527 |
|
|
493 | 528 |
|
494 | 529 |
} |
Also available in: Unified diff
ref #7357 fix TaxonName.clone test in model