Source Code Cross Referenced for JtdsDataSource.java in  » Database-JDBC-Connection-Pool » jTDS » net » sourceforge » jtds » jdbcx » 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 » Database JDBC Connection Pool » jTDS » net.sourceforge.jtds.jdbcx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // jTDS JDBC Driver for Microsoft SQL Server and Sybase
002:        // Copyright (C) 2004 The jTDS Project
003:        //
004:        // This library is free software; you can redistribute it and/or
005:        // modify it under the terms of the GNU Lesser General Public
006:        // License as published by the Free Software Foundation; either
007:        // version 2.1 of the License, or (at your option) any later version.
008:        //
009:        // This library is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:        // Lesser General Public License for more details.
013:        //
014:        // You should have received a copy of the GNU Lesser General Public
015:        // License along with this library; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:        //
018:        package net.sourceforge.jtds.jdbcx;
019:
020:        import java.io.*;
021:        import java.sql.Connection;
022:        import java.sql.SQLException;
023:        import java.util.Properties;
024:        import javax.naming.NamingException;
025:        import javax.naming.Reference;
026:        import javax.naming.Referenceable;
027:        import javax.naming.StringRefAddr;
028:        import javax.sql.ConnectionPoolDataSource;
029:        import javax.sql.DataSource;
030:        import javax.sql.XAConnection;
031:        import javax.sql.XADataSource;
032:
033:        import net.sourceforge.jtds.jdbc.DefaultProperties;
034:        import net.sourceforge.jtds.jdbc.Driver;
035:        import net.sourceforge.jtds.jdbc.Messages;
036:        import net.sourceforge.jtds.jdbc.Support;
037:        import net.sourceforge.jtds.util.Logger;
038:
039:        /**
040:         * The jTDS <code>DataSource</code>, <code>ConnectionPoolDataSource</code> and
041:         * <code>XADataSource</code> implementation.
042:         *
043:         * @author Alin Sinplean
044:         * @since  jTDS 0.3
045:         * @version $Id: JtdsDataSource.java,v 1.42 2007/08/05 17:50:39 bheineman Exp $
046:         */
047:        public class JtdsDataSource implements  DataSource,
048:                ConnectionPoolDataSource, XADataSource, Referenceable,
049:                Serializable {
050:            /** Serial version UID. */
051:            static final long serialVersionUID = 01010000L;
052:
053:            protected String serverName;
054:            protected String serverType;
055:            protected String portNumber;
056:            protected String databaseName;
057:            protected String tdsVersion;
058:            protected String charset;
059:            protected String language;
060:            protected String domain;
061:            protected String useNTLMV2;
062:            protected String instance;
063:            protected String lastUpdateCount;
064:            protected String sendStringParametersAsUnicode;
065:            protected String namedPipe;
066:            protected String macAddress;
067:            protected String prepareSql;
068:            protected String packetSize;
069:            protected String tcpNoDelay;
070:            protected String user;
071:            protected String password;
072:            protected String loginTimeout;
073:            protected String lobBuffer;
074:            protected String maxStatements;
075:            protected String appName;
076:            protected String progName;
077:            protected String wsid;
078:            protected String xaEmulation;
079:            protected String logFile;
080:            protected String socketTimeout;
081:            protected String ssl;
082:            protected String batchSize;
083:            protected String bufferDir;
084:            protected String bufferMaxMemory;
085:            protected String bufferMinPackets;
086:            protected String cacheMetaData;
087:            protected String useCursors;
088:            protected String useLOBs;
089:            protected String bindAddress;
090:            protected String useJCIFS;
091:
092:            protected String description;
093:
094:            /**
095:             * Driver instance used for obtaining connections.
096:             */
097:            private static final Driver driver = new Driver();
098:
099:            /**
100:             * Constructs a new datasource.
101:             */
102:            public JtdsDataSource() {
103:                // Do not set default property values here. Properties whose default
104:                // values depend on server type will likely be incorrect unless the
105:                // user specified them explicitly.
106:            }
107:
108:            /**
109:             * Returns a new XA database connection.
110:             *
111:             * @return a new database connection
112:             * @throws SQLException if an error occurs
113:             */
114:            public XAConnection getXAConnection() throws SQLException {
115:                return new JtdsXAConnection(this , getConnection(user, password));
116:            }
117:
118:            /**
119:             * Returns a new XA database connection for the user and password specified.
120:             *
121:             * @param user     the user name to connect with
122:             * @param password the password to connect with
123:             * @return a new database connection
124:             * @throws SQLException if an error occurs
125:             */
126:            public XAConnection getXAConnection(String user, String password)
127:                    throws SQLException {
128:                return new JtdsXAConnection(this , getConnection(user, password));
129:            }
130:
131:            /**
132:             * Returns a new database connection.
133:             *
134:             * @return a new database connection
135:             * @throws SQLException if an error occurs
136:             */
137:            public Connection getConnection() throws SQLException {
138:                return getConnection(user, password);
139:            }
140:
141:            /**
142:             * Returns a new database connection for the user and password specified.
143:             *
144:             * @param user the user name to connect with
145:             * @param password the password to connect with
146:             * @return a new database connection
147:             * @throws SQLException if an error occurs
148:             */
149:            public Connection getConnection(String user, String password)
150:                    throws SQLException {
151:
152:                if (serverName == null) {
153:                    throw new SQLException(Messages
154:                            .get("error.connection.nohost"), "08001");
155:                }
156:
157:                //
158:                // This maybe the only way to initialise the logging subsystem
159:                // with some containers such as JBOSS.
160:                //
161:                if (getLogWriter() == null && logFile != null
162:                        && logFile.length() > 0) {
163:                    // Try to initialise a PrintWriter
164:                    try {
165:                        setLogWriter(new PrintWriter(new FileOutputStream(
166:                                logFile), true));
167:                    } catch (IOException e) {
168:                        System.err.println("jTDS: Failed to set log file " + e);
169:                    }
170:                }
171:
172:                Properties props = new Properties();
173:                addNonNullProperties(props, user, password);
174:
175:                String url;
176:                try {
177:                    // Determine the server type (for the URL stub) or use the default
178:                    int serverTypeDef = (serverType == null) ? 0 : Integer
179:                            .parseInt(serverType);
180:                    url = "jdbc:jtds:"
181:                            + DefaultProperties
182:                                    .getServerTypeWithDefault(serverTypeDef)
183:                            + ':';
184:                } catch (RuntimeException ex) {
185:                    SQLException sqlException = new SQLException(Messages.get(
186:                            "error.connection.servertype", ex.toString()),
187:                            "08001");
188:                    Support.linkException(sqlException, ex);
189:                    throw sqlException;
190:                }
191:
192:                // Connect with the URL stub and set properties. The defaults will be
193:                // filled in by connect().
194:                return driver.connect(url, props);
195:            }
196:
197:            public Reference getReference() throws NamingException {
198:                Reference ref = new Reference(getClass().getName(),
199:                        JtdsObjectFactory.class.getName(), null);
200:
201:                ref.add(new StringRefAddr(Messages.get(Driver.SERVERNAME),
202:                        serverName));
203:                ref.add(new StringRefAddr(Messages.get(Driver.SERVERTYPE),
204:                        serverType));
205:                ref.add(new StringRefAddr(Messages.get(Driver.PORTNUMBER),
206:                        portNumber));
207:                ref.add(new StringRefAddr(Messages.get(Driver.DATABASENAME),
208:                        databaseName));
209:                ref
210:                        .add(new StringRefAddr(Messages.get(Driver.TDS),
211:                                tdsVersion));
212:                ref
213:                        .add(new StringRefAddr(Messages.get(Driver.CHARSET),
214:                                charset));
215:                ref.add(new StringRefAddr(Messages.get(Driver.LANGUAGE),
216:                        language));
217:                ref.add(new StringRefAddr(Messages.get(Driver.DOMAIN), domain));
218:                ref.add(new StringRefAddr(Messages.get(Driver.USENTLMV2),
219:                        useNTLMV2));
220:                ref.add(new StringRefAddr(Messages.get(Driver.INSTANCE),
221:                        instance));
222:                ref.add(new StringRefAddr(Messages.get(Driver.LASTUPDATECOUNT),
223:                        lastUpdateCount));
224:                ref.add(new StringRefAddr(Messages
225:                        .get(Driver.SENDSTRINGPARAMETERSASUNICODE),
226:                        sendStringParametersAsUnicode));
227:                ref.add(new StringRefAddr(Messages.get(Driver.NAMEDPIPE),
228:                        namedPipe));
229:                ref.add(new StringRefAddr(Messages.get(Driver.MACADDRESS),
230:                        macAddress));
231:                ref.add(new StringRefAddr(Messages.get(Driver.PREPARESQL),
232:                        prepareSql));
233:                ref.add(new StringRefAddr(Messages.get(Driver.PACKETSIZE),
234:                        packetSize));
235:                ref.add(new StringRefAddr(Messages.get(Driver.TCPNODELAY),
236:                        tcpNoDelay));
237:                ref.add(new StringRefAddr(Messages.get(Driver.XAEMULATION),
238:                        xaEmulation));
239:                ref.add(new StringRefAddr(Messages.get(Driver.USER), user));
240:                ref.add(new StringRefAddr(Messages.get(Driver.PASSWORD),
241:                        password));
242:                ref.add(new StringRefAddr(Messages.get(Driver.LOGINTIMEOUT),
243:                        loginTimeout));
244:                ref.add(new StringRefAddr(Messages.get(Driver.SOTIMEOUT),
245:                        socketTimeout));
246:                ref.add(new StringRefAddr(Messages.get(Driver.LOBBUFFER),
247:                        lobBuffer));
248:                ref.add(new StringRefAddr(Messages.get(Driver.MAXSTATEMENTS),
249:                        maxStatements));
250:                ref
251:                        .add(new StringRefAddr(Messages.get(Driver.APPNAME),
252:                                appName));
253:                ref.add(new StringRefAddr(Messages.get(Driver.PROGNAME),
254:                        progName));
255:                ref.add(new StringRefAddr(Messages.get(Driver.WSID), wsid));
256:                ref
257:                        .add(new StringRefAddr(Messages.get(Driver.LOGFILE),
258:                                logFile));
259:                ref.add(new StringRefAddr(Messages.get(Driver.SSL), ssl));
260:                ref.add(new StringRefAddr(Messages.get(Driver.BATCHSIZE),
261:                        batchSize));
262:                ref.add(new StringRefAddr(Messages.get(Driver.BUFFERDIR),
263:                        bufferDir));
264:                ref.add(new StringRefAddr(Messages.get(Driver.BUFFERMAXMEMORY),
265:                        bufferMaxMemory));
266:                ref
267:                        .add(new StringRefAddr(Messages
268:                                .get(Driver.BUFFERMINPACKETS), bufferMinPackets));
269:                ref.add(new StringRefAddr(Messages.get(Driver.CACHEMETA),
270:                        cacheMetaData));
271:                ref.add(new StringRefAddr(Messages.get(Driver.USECURSORS),
272:                        useCursors));
273:                ref
274:                        .add(new StringRefAddr(Messages.get(Driver.USELOBS),
275:                                useLOBs));
276:                ref.add(new StringRefAddr(Messages.get(Driver.BINDADDRESS),
277:                        bindAddress));
278:                ref.add(new StringRefAddr(Messages.get(Driver.USEJCIFS),
279:                        useJCIFS));
280:
281:                ref.add(new StringRefAddr("description", description));
282:
283:                return ref;
284:            }
285:
286:            //
287:            // ConnectionPoolDataSource methods
288:            //
289:
290:            /**
291:             * Returns a new pooled database connection.
292:             *
293:             * @return a new pooled database connection
294:             * @throws SQLException if an error occurs
295:             */
296:            public javax.sql.PooledConnection getPooledConnection()
297:                    throws SQLException {
298:                return getPooledConnection(user, password);
299:            }
300:
301:            /**
302:             * Returns a new pooled database connection for the user and password specified.
303:             *
304:             * @param user the user name to connect with
305:             * @param password the password to connect with
306:             * @return a new pooled database connection
307:             * @throws SQLException if an error occurs
308:             */
309:            public synchronized javax.sql.PooledConnection getPooledConnection(
310:                    String user, String password) throws SQLException {
311:                return new net.sourceforge.jtds.jdbcx.PooledConnection(
312:                        getConnection(user, password));
313:            }
314:
315:            //
316:            // Getters and setters
317:            //
318:
319:            public PrintWriter getLogWriter() throws SQLException {
320:                return Logger.getLogWriter();
321:            }
322:
323:            public void setLogWriter(PrintWriter out) throws SQLException {
324:                Logger.setLogWriter(out);
325:            }
326:
327:            public void setLoginTimeout(int loginTimeout) throws SQLException {
328:                this .loginTimeout = String.valueOf(loginTimeout);
329:            }
330:
331:            public int getLoginTimeout() throws SQLException {
332:                if (loginTimeout == null) {
333:                    return 0;
334:                }
335:                return Integer.parseInt(loginTimeout);
336:            }
337:
338:            public void setSocketTimeout(int socketTimeout) throws SQLException {
339:                this .socketTimeout = String.valueOf(socketTimeout);
340:            }
341:
342:            public int getSocketTimeout() throws SQLException {
343:                if (socketTimeout == null) {
344:                    return 0;
345:                }
346:                return Integer.parseInt(socketTimeout);
347:            }
348:
349:            public void setDatabaseName(String databaseName) {
350:                this .databaseName = databaseName;
351:            }
352:
353:            public String getDatabaseName() {
354:                return databaseName;
355:            }
356:
357:            public void setDescription(String description) {
358:                this .description = description;
359:            }
360:
361:            public String getDescription() {
362:                return description;
363:            }
364:
365:            public void setPassword(String password) {
366:                this .password = password;
367:            }
368:
369:            public String getPassword() {
370:                return password;
371:            }
372:
373:            public void setPortNumber(int portNumber) {
374:                this .portNumber = String.valueOf(portNumber);
375:            }
376:
377:            public int getPortNumber() {
378:                if (portNumber == null) {
379:                    return 0;
380:                }
381:                return Integer.parseInt(portNumber);
382:            }
383:
384:            public void setServerName(String serverName) {
385:                this .serverName = serverName;
386:            }
387:
388:            public String getServerName() {
389:                return serverName;
390:            }
391:
392:            public void setUser(String user) {
393:                this .user = user;
394:            }
395:
396:            public String getUser() {
397:                return user;
398:            }
399:
400:            public void setTds(String tds) {
401:                this .tdsVersion = tds;
402:            }
403:
404:            public String getTds() {
405:                return tdsVersion;
406:            }
407:
408:            // TODO Use sqlserver/sybase for this (instead of numeric values)
409:            public void setServerType(int serverType) {
410:                this .serverType = String.valueOf(serverType);
411:            }
412:
413:            public int getServerType() {
414:                if (serverType == null) {
415:                    return 0;
416:                }
417:                return Integer.parseInt(serverType);
418:            }
419:
420:            public String getDomain() {
421:                return domain;
422:            }
423:
424:            public void setDomain(String domain) {
425:                this .domain = domain;
426:            }
427:
428:            public String getUseNTLMV2() {
429:                return useNTLMV2;
430:            }
431:
432:            public void setUseNTLMV2(String usentlmv2) {
433:                this .useNTLMV2 = usentlmv2;
434:            }
435:
436:            public String getInstance() {
437:                return instance;
438:            }
439:
440:            public void setInstance(String instance) {
441:                this .instance = instance;
442:            }
443:
444:            public boolean getSendStringParametersAsUnicode() {
445:                return Boolean.valueOf(sendStringParametersAsUnicode)
446:                        .booleanValue();
447:            }
448:
449:            public void setSendStringParametersAsUnicode(
450:                    boolean sendStringParametersAsUnicode) {
451:                this .sendStringParametersAsUnicode = String
452:                        .valueOf(sendStringParametersAsUnicode);
453:            }
454:
455:            public boolean getNamedPipe() {
456:                return Boolean.valueOf(namedPipe).booleanValue();
457:            }
458:
459:            public void setNamedPipe(boolean namedPipe) {
460:                this .namedPipe = String.valueOf(namedPipe);
461:            }
462:
463:            public boolean getLastUpdateCount() {
464:                return Boolean.valueOf(lastUpdateCount).booleanValue();
465:            }
466:
467:            public void setLastUpdateCount(boolean lastUpdateCount) {
468:                this .lastUpdateCount = String.valueOf(lastUpdateCount);
469:            }
470:
471:            public boolean getXaEmulation() {
472:                return Boolean.valueOf(xaEmulation).booleanValue();
473:            }
474:
475:            public void setXaEmulation(boolean xaEmulation) {
476:                this .xaEmulation = String.valueOf(xaEmulation);
477:            }
478:
479:            public String getCharset() {
480:                return charset;
481:            }
482:
483:            public void setCharset(String charset) {
484:                this .charset = charset;
485:            }
486:
487:            public String getLanguage() {
488:                return language;
489:            }
490:
491:            public void setLanguage(String language) {
492:                this .language = language;
493:            }
494:
495:            public String getMacAddress() {
496:                return macAddress;
497:            }
498:
499:            public void setMacAddress(String macAddress) {
500:                this .macAddress = macAddress;
501:            }
502:
503:            public void setPacketSize(int packetSize) {
504:                this .packetSize = String.valueOf(packetSize);
505:            }
506:
507:            public int getPacketSize() {
508:                if (packetSize == null) {
509:                    return 0;
510:                }
511:                return Integer.parseInt(packetSize);
512:            }
513:
514:            public boolean getTcpNoDelay() {
515:                return Boolean.valueOf(tcpNoDelay).booleanValue();
516:            }
517:
518:            public void setTcpNoDelay(boolean tcpNoDelay) {
519:                this .tcpNoDelay = String.valueOf(tcpNoDelay);
520:            }
521:
522:            public void setPrepareSql(int prepareSql) {
523:                this .prepareSql = String.valueOf(prepareSql);
524:            }
525:
526:            public int getPrepareSql() {
527:                if (prepareSql == null) {
528:                    return 0;
529:                }
530:                return Integer.parseInt(prepareSql);
531:            }
532:
533:            public void setLobBuffer(long lobBuffer) {
534:                this .lobBuffer = String.valueOf(lobBuffer);
535:            }
536:
537:            public long getLobBuffer() {
538:                if (lobBuffer == null) {
539:                    return 0;
540:                }
541:                return Long.parseLong(lobBuffer);
542:            }
543:
544:            public void setMaxStatements(int maxStatements) {
545:                this .maxStatements = String.valueOf(maxStatements);
546:            }
547:
548:            public int getMaxStatements() {
549:                if (maxStatements == null) {
550:                    return 0;
551:                }
552:                return Integer.parseInt(maxStatements);
553:            }
554:
555:            public void setAppName(String appName) {
556:                this .appName = appName;
557:            }
558:
559:            public String getAppName() {
560:                return appName;
561:            }
562:
563:            public void setProgName(String progName) {
564:                this .progName = progName;
565:            }
566:
567:            public String getProgName() {
568:                return progName;
569:            }
570:
571:            public void setWsid(String wsid) {
572:                this .wsid = wsid;
573:            }
574:
575:            public String getWsid() {
576:                return wsid;
577:            }
578:
579:            public void setLogFile(String logFile) {
580:                this .logFile = logFile;
581:            }
582:
583:            public String getLogFile() {
584:                return logFile;
585:            }
586:
587:            public void setSsl(String ssl) {
588:                this .ssl = ssl;
589:            }
590:
591:            public String getSsl() {
592:                return ssl;
593:            }
594:
595:            public void setBatchSize(int batchSize) {
596:                this .batchSize = String.valueOf(batchSize);
597:            }
598:
599:            public int getBatchSize() {
600:                if (batchSize == null) {
601:                    return 0;
602:                }
603:                return Integer.parseInt(batchSize);
604:            }
605:
606:            public String getBufferDir() {
607:                if (bufferDir == null) {
608:                    return System.getProperty("java.io.tmpdir");
609:                }
610:
611:                return bufferDir;
612:            }
613:
614:            public void setBufferDir(String bufferDir) {
615:                this .bufferDir = bufferDir;
616:            }
617:
618:            public int getBufferMaxMemory() {
619:                if (bufferMaxMemory == null) {
620:                    return 0;
621:                }
622:                return Integer.parseInt(bufferMaxMemory);
623:            }
624:
625:            public void setBufferMaxMemory(int bufferMaxMemory) {
626:                this .bufferMaxMemory = String.valueOf(bufferMaxMemory);
627:            }
628:
629:            public int getBufferMinPackets() {
630:                if (bufferMinPackets == null) {
631:                    return 0;
632:                }
633:                return Integer.parseInt(bufferMinPackets);
634:            }
635:
636:            public void setBufferMinPackets(int bufferMinPackets) {
637:                this .bufferMinPackets = String.valueOf(bufferMinPackets);
638:            }
639:
640:            public boolean getCacheMetaData() {
641:                return Boolean.valueOf(cacheMetaData).booleanValue();
642:            }
643:
644:            public void setCacheMetaData(boolean cacheMetaData) {
645:                this .cacheMetaData = String.valueOf(cacheMetaData);
646:            }
647:
648:            public boolean getUseCursors() {
649:                return Boolean.valueOf(useCursors).booleanValue();
650:            }
651:
652:            public void setUseCursors(boolean useCursors) {
653:                this .useCursors = String.valueOf(useCursors);
654:            }
655:
656:            public boolean getUseLOBs() {
657:                return Boolean.valueOf(useLOBs).booleanValue();
658:            }
659:
660:            public void setUseLOBs(boolean useLOBs) {
661:                this .useLOBs = String.valueOf(useLOBs);
662:            }
663:
664:            public String getBindAddress() {
665:                return bindAddress;
666:            }
667:
668:            public void setBindAddress(String bindAddress) {
669:                this .bindAddress = bindAddress;
670:            }
671:
672:            public boolean getUseJCIFS() {
673:                return Boolean.valueOf(useJCIFS).booleanValue();
674:            }
675:
676:            public void setUseJCIFS(boolean useJCIFS) {
677:                this .useJCIFS = String.valueOf(useJCIFS);
678:            }
679:
680:            private void addNonNullProperties(Properties props, String user,
681:                    String password) {
682:                props.setProperty(Messages.get(Driver.SERVERNAME), serverName);
683:                if (serverType != null) {
684:                    props.setProperty(Messages.get(Driver.SERVERTYPE),
685:                            serverType);
686:                }
687:                if (portNumber != null) {
688:                    props.setProperty(Messages.get(Driver.PORTNUMBER),
689:                            portNumber);
690:                }
691:                if (databaseName != null) {
692:                    props.setProperty(Messages.get(Driver.DATABASENAME),
693:                            databaseName);
694:                }
695:                if (tdsVersion != null) {
696:                    props.setProperty(Messages.get(Driver.TDS), tdsVersion);
697:                }
698:                if (charset != null) {
699:                    props.setProperty(Messages.get(Driver.CHARSET), charset);
700:                }
701:                if (language != null) {
702:                    props.setProperty(Messages.get(Driver.LANGUAGE), language);
703:                }
704:                if (domain != null) {
705:                    props.setProperty(Messages.get(Driver.DOMAIN), domain);
706:                }
707:                if (useNTLMV2 != null) {
708:                    props
709:                            .setProperty(Messages.get(Driver.USENTLMV2),
710:                                    useNTLMV2);
711:                }
712:                if (instance != null) {
713:                    props.setProperty(Messages.get(Driver.INSTANCE), instance);
714:                }
715:                if (lastUpdateCount != null) {
716:                    props.setProperty(Messages.get(Driver.LASTUPDATECOUNT),
717:                            lastUpdateCount);
718:                }
719:                if (sendStringParametersAsUnicode != null) {
720:                    props.setProperty(Messages
721:                            .get(Driver.SENDSTRINGPARAMETERSASUNICODE),
722:                            sendStringParametersAsUnicode);
723:                }
724:                if (namedPipe != null) {
725:                    props
726:                            .setProperty(Messages.get(Driver.NAMEDPIPE),
727:                                    namedPipe);
728:                }
729:                if (macAddress != null) {
730:                    props.setProperty(Messages.get(Driver.MACADDRESS),
731:                            macAddress);
732:                }
733:                if (prepareSql != null) {
734:                    props.setProperty(Messages.get(Driver.PREPARESQL),
735:                            prepareSql);
736:                }
737:                if (packetSize != null) {
738:                    props.setProperty(Messages.get(Driver.PACKETSIZE),
739:                            packetSize);
740:                }
741:                if (tcpNoDelay != null) {
742:                    props.setProperty(Messages.get(Driver.TCPNODELAY),
743:                            tcpNoDelay);
744:                }
745:                if (xaEmulation != null) {
746:                    props.setProperty(Messages.get(Driver.XAEMULATION),
747:                            xaEmulation);
748:                }
749:                if (user != null) {
750:                    props.setProperty(Messages.get(Driver.USER), user);
751:                }
752:                if (password != null) {
753:                    props.setProperty(Messages.get(Driver.PASSWORD), password);
754:                }
755:                if (loginTimeout != null) {
756:                    props.setProperty(Messages.get(Driver.LOGINTIMEOUT),
757:                            loginTimeout);
758:                }
759:                if (socketTimeout != null) {
760:                    props.setProperty(Messages.get(Driver.SOTIMEOUT),
761:                            socketTimeout);
762:                }
763:                if (lobBuffer != null) {
764:                    props
765:                            .setProperty(Messages.get(Driver.LOBBUFFER),
766:                                    lobBuffer);
767:                }
768:                if (maxStatements != null) {
769:                    props.setProperty(Messages.get(Driver.MAXSTATEMENTS),
770:                            maxStatements);
771:                }
772:                if (appName != null) {
773:                    props.setProperty(Messages.get(Driver.APPNAME), appName);
774:                }
775:                if (progName != null) {
776:                    props.setProperty(Messages.get(Driver.PROGNAME), progName);
777:                }
778:                if (wsid != null) {
779:                    props.setProperty(Messages.get(Driver.WSID), wsid);
780:                }
781:                if (ssl != null) {
782:                    props.setProperty(Messages.get(Driver.SSL), ssl);
783:                }
784:                if (batchSize != null) {
785:                    props
786:                            .setProperty(Messages.get(Driver.BATCHSIZE),
787:                                    batchSize);
788:                }
789:                if (bufferDir != null) {
790:                    props
791:                            .setProperty(Messages.get(Driver.BUFFERDIR),
792:                                    bufferDir);
793:                }
794:                if (bufferMaxMemory != null) {
795:                    props.setProperty(Messages.get(Driver.BUFFERMAXMEMORY),
796:                            bufferMaxMemory);
797:                }
798:                if (bufferMinPackets != null) {
799:                    props.setProperty(Messages.get(Driver.BUFFERMINPACKETS),
800:                            bufferMinPackets);
801:                }
802:                if (cacheMetaData != null) {
803:                    props.setProperty(Messages.get(Driver.CACHEMETA),
804:                            cacheMetaData);
805:                }
806:                if (useCursors != null) {
807:                    props.setProperty(Messages.get(Driver.USECURSORS),
808:                            useCursors);
809:                }
810:                if (useLOBs != null) {
811:                    props.setProperty(Messages.get(Driver.USELOBS), useLOBs);
812:                }
813:                if (bindAddress != null) {
814:                    props.setProperty(Messages.get(Driver.BINDADDRESS),
815:                            bindAddress);
816:                }
817:                if (useJCIFS != null) {
818:                    props.setProperty(Messages.get(Driver.USEJCIFS), useJCIFS);
819:                }
820:            }
821:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.