Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
jTDS JDBC Driver Source Code Files
jTDS JDBC Driver Source Code Files are provided in the source package file, jtds-1.3.1-fyi.zip.
You can browse jTDS JDBC Driver Source Code files below:
✍: FYIcenter.com
⏎ net/sourceforge/jtds/jdbc/SharedNamedPipe.java
// jTDS JDBC Driver for Microsoft SQL Server and Sybase // Copyright (C) 2004 The jTDS Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // package net.sourceforge.jtds.jdbc; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration; import jcifs.Config; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbNamedPipe; /** * This class implements inter-process communication (IPC) to the * database server using named pipes. * * @todo Extract abstract base class SharedIpc from <code>SharedSocket</code> and this class. * @todo Implement connection timeouts for named pipes. * * @author David D. Kilzer * @version $Id: SharedNamedPipe.java,v 1.19.2.2 2009-12-10 09:54:04 ickzon Exp $ */ public class SharedNamedPipe extends SharedSocket { /** * The shared named pipe. */ private SmbNamedPipe pipe; /** * Creates a new instance of <code>SharedNamedPipe</code>. * * @param connection * @throws IOException if the named pipe or its input or output streams do * not open * @throws UnknownHostException if host cannot be found for the named pipe */ public SharedNamedPipe(JtdsConnection connection) throws IOException { super(connection.getBufferDir(), connection.getTdsVersion(), connection.getServerType()); // apply socketTimeout as responseTimeout int timeout = connection.getSocketTimeout() * 1000; String val = String.valueOf(timeout > 0 ? timeout : Integer.MAX_VALUE); Config.setProperty("jcifs.smb.client.responseTimeout", val); Config.setProperty("jcifs.smb.client.soTimeout", val); NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication( connection.getDomainName(), connection.getUser(), connection.getPassword()); StringBuilder url = new StringBuilder(32); url.append("smb://"); url.append(connection.getServerName()); url.append("/IPC$"); final String instanceName = connection.getInstanceName(); if (instanceName != null && instanceName.length() != 0) { url.append("/MSSQL$"); url.append(instanceName); } String namedPipePath = DefaultProperties.getNamedPipePath(connection.getServerType()); url.append(namedPipePath); setPipe(new SmbNamedPipe(url.toString(), SmbNamedPipe.PIPE_TYPE_RDWR, auth)); setOut(new DataOutputStream(getPipe().getNamedPipeOutputStream())); final int bufferSize = Support.calculateNamedPipeBufferSize( connection.getTdsVersion(), connection.getPacketSize()); setIn(new DataInputStream( new BufferedInputStream( getPipe().getNamedPipeInputStream(), bufferSize))); } String getMAC() { try { Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); while( nics.hasMoreElements() ) { NetworkInterface nic = nics.nextElement(); try { if( ! nic.isLoopback() && ! nic.isVirtual() ) { byte[] address = nic.getHardwareAddress(); if( address != null ) { String mac = ""; for( int k = 0; k < address.length; k ++ ) { String macValue = String.format("%02X", address[k] ); mac += macValue; } return mac; } } } catch( SocketException e ) { // ignore errors for single NICs } } } catch( SocketException e ) { // error getting network interfaces, return null } return null; } /** * Get the connected status of this socket. * * @return true if the underlying socket is connected */ boolean isConnected() { return getPipe() != null; } /** * Close the socket (noop if in shared mode). */ void close() throws IOException { super.close(); getOut().close(); getIn().close(); //getPipe().close(); } /** * Force close the socket causing any pending reads/writes to fail. * <p/> * Used by the login timer to abort a login attempt. */ void forceClose() { try { getOut().close(); } catch (IOException e) { // Ignore } finally { setOut(null); } try { getIn().close(); } catch (IOException e) { // Ignore } finally { setIn(null); } setPipe(null); } /** * Getter for {@link SharedNamedPipe#pipe} field. * * @return {@link SmbNamedPipe} used for communication */ private SmbNamedPipe getPipe() { return pipe; } /** * Setter for {@link SharedNamedPipe#pipe} field. * * @param pipe {@link SmbNamedPipe} to be used for communication */ private void setPipe(SmbNamedPipe pipe) { this.pipe = pipe; } /** * Set the socket timeout. * <p/> * Noop for now; timeouts are not implemented for SMB named pipes. * * @param timeout timeout value in milliseconds */ protected void setTimeout(int timeout) { // FIXME - implement timeout functionality } }
⏎ net/sourceforge/jtds/jdbc/SharedNamedPipe.java
Or download all of them as a single archive file:
File name: jtds-1.3.1-fyi.zip File size: 323160 bytes Release date: 2013-06-08 Download
⇐ What Is jtds-1.3.1-dist.zip?
2016-11-26, 7841👍, 0💬
Popular Posts:
Apache Log4j API provides the interface that applications should code to and provides the adapter co...
commons-lang-1.0.1.jar is the JAR file for Apache Commons Lang 1.0.1, which provides a host of helpe...
kernel.jar is a component in iText Java library to provide low-level functionalities. iText Java lib...
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...