Source Code Cross Referenced for Jdbc.java in  » Web-Server » Jigsaw » org » w3c » tools » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Jigsaw » org.w3c.tools.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Jdbc.java
002:        // $Id: Jdbc.java,v 1.7 2000/08/16 21:37:49 ylafon Exp $
003:        // (c) COPYRIGHT MIT, INRIA and Keio, 2000.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.tools.jdbc;
007:
008:        import java.util.Properties;
009:
010:        /**
011:         * @version $Revision: 1.7 $
012:         * @author  Benoît Mahé (bmahe@w3.org)
013:         */
014:        public class Jdbc {
015:
016:            public final static String MAX_CONNECTIONS_P = "org.w3c.tools.jdbc.maxconn";
017:
018:            public final static int DEFAULT_MAX_CONN = 10;
019:
020:            public final static String JDBC_DRIVER_P = "org.w3c.tools.jdbc.jdbcdriver";
021:
022:            public final static String USER_P = "org.w3c.tools.jdbc.user";
023:
024:            public final static String PASSWORD_P = "org.w3c.tools.jdbc.password";
025:
026:            public static int getMaxConn(Properties props) {
027:                return getInt(props, MAX_CONNECTIONS_P, DEFAULT_MAX_CONN);
028:            }
029:
030:            public static Properties setMaxConn(Properties props, int max) {
031:                if (max < 1) {
032:                    props.put(MAX_CONNECTIONS_P, String
033:                            .valueOf(DEFAULT_MAX_CONN));
034:                } else {
035:                    props.put(MAX_CONNECTIONS_P, String.valueOf(max));
036:                }
037:                return props;
038:            }
039:
040:            public static String getDriver(Properties props) {
041:                return (String) props.get(JDBC_DRIVER_P);
042:            }
043:
044:            public static Properties setDriver(Properties props, String driver) {
045:                if (driver != null)
046:                    props.put(JDBC_DRIVER_P, driver);
047:                return props;
048:            }
049:
050:            public static String getUser(Properties props) {
051:                return (String) props.get(USER_P);
052:            }
053:
054:            public static Properties setUser(Properties props, String user) {
055:                if (user != null)
056:                    props.put(USER_P, user);
057:                return props;
058:            }
059:
060:            public static String getPassword(Properties props) {
061:                return (String) props.get(PASSWORD_P);
062:            }
063:
064:            public static Properties setPassword(Properties props,
065:                    String password) {
066:                if (password != null)
067:                    props.put(PASSWORD_P, password);
068:                return props;
069:            }
070:
071:            //
072:            // private
073:            //
074:
075:            private static void setBoolean(Properties props, String name,
076:                    boolean bool) {
077:                props.put(name, String.valueOf(bool));
078:            }
079:
080:            private static boolean getBoolean(Properties props, String name) {
081:                String p = (String) props.get(name);
082:                if (p != null) {
083:                    return p.equalsIgnoreCase("true");
084:                }
085:                return false;
086:            }
087:
088:            private static int getInt(Properties props, String name, int def) {
089:                String str = (String) props.get(name);
090:                if (str != null) {
091:                    try {
092:                        return Integer.parseInt(str);
093:                    } catch (NumberFormatException ex) {
094:                        return def;
095:                    }
096:                } else {
097:                    return def;
098:                }
099:            }
100:
101:            private static void setInt(Properties props, String name, int i) {
102:                String sint = String.valueOf(i);
103:                props.put(name, sint);
104:            }
105:
106:            private static long getLong(Properties props, String name, long def) {
107:                String str = (String) props.get(name);
108:                if (str != null) {
109:                    try {
110:                        return Long.parseLong(str);
111:                    } catch (NumberFormatException ex) {
112:                        return def;
113:                    }
114:                } else {
115:                    return def;
116:                }
117:            }
118:
119:            private static void setLong(Properties props, String name, long l) {
120:                String slong = String.valueOf(l);
121:                props.put(name, slong);
122:            }
123:
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.