Jtds connection

dear all;
My problem is unable to connect data base using jtds Driver.My code is .
import java.sql.*;
public class SimpleTest {
SimpleTest(){
String username = "sa";
String Password ="1234";
String VehicleID = "";
String sql = "select VehicleID from Deviceinfo";
try{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection con= DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/sms",username,Password);
System.out.println("Connecting");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
VehicleID = rs.getString("VehicleID");
System.out.println(VehicleID);
catch(ClassNotFoundException e){
System.err.print(e);
catch(SQLException e1){
System.err.print(e1);
public static void main(String ar[]){
SimpleTest st = new SimpleTest();
Indicate Error is java.sql.SQLException: Network error IOException: Connection refused: connect
jtds FAQ site says
The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:
*1. The server name is misspelled or the port number is incorrect.*
*2. SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).*
*3. There is a firewall blocking port 1433 on the server.*
My firewall is disable.
My tcp/ip port is also 1433 i check it .
problem is still having.
can you help me to solve this problem.

Xpost http://forum.java.sun.com/thread.jspa?threadID=611166&messageID=3361450
Mr. Deore Shiva: you seem to have a habit of crossposting essay questions, and then ignoring requests for further information on your problems. Do you actually ever come back to read the answers?

Similar Messages

  • JTDS JDBC CONNECTON ERROR

    ha ii
    I try to connect my database using jtds driver.Error indicate **java.sql.SQLException: Network error IOException: Connection refused: connect* , then i check jtds Faq then i fallow these steps
    Why do I get java.sql.SQLException: "Network error IOException: Connection refused: connect" when trying to get a connection?
    The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:
    1. The server name is misspelled or the port number is incorrect.
    2. SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
    3. There is a firewall blocking port 1433 on the server.
    Error is still
    I disable firewall also
    my jdbc url is
    *("jdbc:jtds:sqlserver://220.247.224.219:1433/sms;username;password");*
    I install jtds driver on the c: drive program folder and configure it.
    can any one help me to solve this problem.
    So i wont to check my jtds installation correct , plese tel me how to install the jtds driver.
    can any one help me
    thank you

    The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:
    1. The server name is misspelled or the port number is incorrect.
    2. SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
    3. There is a firewall blocking port 1433 on the server.
    Error is still
    I disable firewall also On both the client and the server?
    Your problem is then either 1 or 2.

  • Java.sql.SQLException: Login failed for user 'ccms'.

    Windows Server 2003 R2 Enterprise x64 Edition service pack 1
    SQL Server 2000 Enterprise edition 32 bit, SP4 : 2000.8.00.2039
    jdbc driver: jtds
    connection string: jdbc:jtdsqlserver://ZH-DATA-4:1434/[dbname];instance=[instance name]
    the connectivity works fine...almost.
    I have 2 identical sql servers one of which is linked to the other via a linked server config which for one particular query gives back the error I give in the subject of this thread:
    java.sql.SQLException: Could not get the data of the row from the OLE DB provider 'SQLOLEDB'
    if I run the exact same sql string in query analyser it runs with no problem.
    if have similar queries also running from java which use the linked server and these do not give an error. I am at a loss as to explain why this is happening.
    the query in question joins together a number of views which reference the linked server.
    I have tried everything I can think of including recreating the views and linked server definition.
    If all is OK in query analyser, how can it fail when called over jbdc (especially when all other db requests succeed) ?

    refer below link
    http://blog.soapplied.com/2013/06/websphere-distributed-transactions-with.html

  • Error with Crystal 2008 Exporting MS Excel using ReportExportFormat.MSExcel

    Hi
    </br>
    </br>
    I am using the sample code that comes with the Eclipse plug-in. I have modified it slightly to also write to different formats and then display in the viewer. I am able to write to all formats except to the MSExcel (MSExcel data only works without issue)
    </br>
    </br>
    <p>
    I am using the following code (this is just proof of concept code)</br>
                    //jtds connection and database logon setup already</br>
                    //report parameters etc setup already</br>
                    try</br>
                    {</br>
                         String file_name = reportClientDocument.displayName() + System.currentTimeMillis();</br>
                          file_name = file_name + ".xls";</br>
                          String location = "c:
    temp
    ";</br>
                          FileOutputStream fos = new FileOutputStream(location + file_name);</br>
                          </br>
                          ByteArrayInputStream byteArrayInputStream;</br>
    </br>
                          byteArrayInputStream = (ByteArrayInputStream) reportClientDocument</br>
                                  .getPrintOutputController().export(ReportExportFormat.MSExcel);</br>
    </br>
                          byte[] byteArray = new byte[1024];</br>
                          int bytesRead;</br>
                          while((bytesRead = byteArrayInputStream.read(byteArray)) != -1) </br>
                          {</br>
                               fos.write(byteArray, 0, bytesRead);     </br>
                          }</br>
    </br>
                          fos.flush();</br>
                          fos.close();</br>
                          setReportSource ();</br>
                    }</br>
    </p>
    </br>
    <p>
    Console/Error Output:
    Crystal Reports Viewer 12.0.0.0
    java.vendor = Sun Microsystems Inc.
    java.version = 1.5.0
    os.name = Windows XP
    os.version = 5.1
    os.arch = x86
    log4j:WARN No appenders could be found for logger (com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.FCMCellModel).
    log4j:WARN Please initialize the log4j system properly.
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: IllegalArgumentExceptionWithMessage---- Error code:-2147467259 Error code name:failed
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:237)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:147)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:128)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:111)
         at com.businessobjects.samples.SampleViewerFrame.showReport(SampleViewerFrame.java:145)
         at com.businessobjects.samples.SampleViewerFrame.showViewer(SampleViewerFrame.java:98)
         at com.businessobjects.samples.SampleViewerFrameClient.main(SampleViewerFrameClient.java:17)
    Caused by: com.crystaldecisions.reports.common.GeneralException: IllegalArgumentExceptionWithMessage
         at com.crystaldecisions.reports.exporters.excel.libs.escher.p.<init>(SourceFile:149)
         at com.crystaldecisions.reports.exporters.excel.libs.escher.BlipChecksumGenerator.a(SourceFile:47)
         at com.crystaldecisions.reports.exporters.excel.libs.escher.ad.a(SourceFile:93)
         at com.crystaldecisions.reports.exporters.excel.libs.escher.af.a(SourceFile:186)
         at com.crystaldecisions.reports.exporters.excel.libs.escher.EscherDocumentForExcel.a(SourceFile:119)
         at com.crystaldecisions.reports.exporters.excel.libs.escher.EscherDrawingSheetForExcel.a(SourceFile:283)
         at com.crystaldecisions.reports.exporters.excel.libs.biff.xlsDOM.ExcelWorksheet.a(SourceFile:251)
         at com.crystaldecisions.reports.exporters.excel.formatter.cm.ExcelCMGraphicsObjectFormatter.a(SourceFile:167)
         at com.crystaldecisions.reports.exporters.excel.formatter.Excel97ExportFormatter.a(SourceFile:193)
         at com.crystaldecisions.reports.exporters.excel.formatter.Excel97ExportFormatter.a(SourceFile:169)
         at com.crystaldecisions.reports.exporters.excel.formatter.Excel97ExportFormatter.a(SourceFile:110)
         at com.crystaldecisions.reports.exporters.excel.Excel97Exporter.processFormattedContent(SourceFile:213)
         at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:104)
         at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:247)
         at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:642)
         at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:586)
         at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:636)
         at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:672)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1944)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:661)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:167)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:529)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:527)
         at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:525)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:424)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:352)
         at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
         at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
         at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
         at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
         at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:223)
         ... 6 more
    Any help will be greatly appreciated, this seems as if its a bug though.
    </p>
    Edited by: Kabir Bray on Nov 2, 2010 4:26 PM

    I know this has been marked as answered, but I would just like to mention when designing reports for Excel output, the key thing
    to remember is the design and layout of your report. You have to work on a strict grid layout concept, and make sure all items are
    lined up 100% else columns or rows are inserted in strange places, making the output look very ugly. But if you can line everything
    up nicely then I believe any report that can be displayed in Excel.
    Keeping in mind that if the report is to be output as Excel the whole design and logic must be geared for this, so page headers
    and footers are no longer relevant, in fact the whole "page" concept must be ignored when working with Excel as there are
    no pages in a spreadsheet application like Excel.
    That all being said, I dont know what your reports are about and am not saying they are not too complex for Excel,
    just wanted to make a note so that people dont think Excel output using CR4E is a bad option.

  • No suitable driver when connect MS SQL server from Oracle 10g using JTDS

    Hi,
    I have developed a java servlet application connection to MS SQL using jtds-1.2.jar. I have try to deploy this application to Oracle 9ias and it works fine.
    However, when I deploy the same application to Oracle 10g (10.1.2.0.2), I encounter this error - java.sql.SQLException: No suitable driver.
    I have copy the jtds-1.2.jar to Ora10g/jdbc/lib, Ora10g/j2ee/home/lib and also the Ora10g/j233/OC$J_GENERAL/applications/sampleApp/sampleApp/WEB-INF/lib folder, and also setup the data source via the EM interface. The data-source.xml entry is as follows:
    <data-source location="jdbc/ess" class="com.evermind.sql.DriverManagerDataSource" xa-location="jdbc/xa/essS" ejb-location="jdbc/ess" connection-driver="net.sourceforge.jtds.jdbc.Driver" username="scott" url="jdbc:jtds:sqlserver://202.xx.xx.xx:1433/sampleDB" inactivity-timeout="30" name="ess"/>
    </data-sources>
    Is there any configuration that I've forgotten to set?

    >
    I have developed a java servlet application
    connection to MS SQL using jtds-1.2.jar. I have try
    to deploy this application to Oracle 9ias and it
    works fine.
    However, when I deploy the same application to Oracle
    10g (10.1.2.0.2), I encounter this error -
    java.sql.SQLException: No suitable driver.
    I have copy the jtds-1.2.jar to Ora10g/jdbc/lib,
    Ora10g/j2ee/home/lib and also the
    Ora10g/j233/OC$J_GENERAL/applications/sampleApp/sample
    App/WEB-INF/lib folder, and also setup the data
    source via the EM interface.
    Is there any configuration that I've forgotten to set?The JAR file needs to be in a place the container can locate it correctly. This is the applib directory for your OC4J instance.
    Which I believe from what you have entered is:
    Ora10g/j2ee/OC4J_GENERAL/applib
    There's a general JDBC 3rd party driver set of documentation here:
    http://download.oracle.com/docs/cd/B14099_11/web.1012/b14012/datasrc.htm#sthref592
    This is not using jtds-1.2.jar but it shows how another set of 3rd party jdbc libs are used with the server.
    -steve-

  • Added jTDS as third party DB connector to Oracle SQL Developer and connecti

    I have followed the directions for adding a third party db connector to SQL Developer however as soon as I do the connection manager form doesn't come up for both adding a new connection and editing an exisitng one. I have posted here as I am having issues finsing information or getting help through Oracle forums.

    Two things:
    1 - Confirm you got the jTDS we recommend from here http://www.oracle.com/technetwork/database/migration/omwb-getstarted-093461.html#conf
    2 - Confirm you added the entry in the preferences and pointed to the actual JAR file, not just the directory

  • JTDS not connecting with SQL Server 2008 R2 SP2 + SSL with Java 6 U34-35

    Environment:
    Windows 7 Pro 32-bit
    SQL Server 2008 R2 SP2 (Forced Encryption = Yes, No Certificate provided to server)
    Java 6 Update 27-35 and Java 7 Update 2-7
    jTDS 1.2.2 and 1.2.6
    Under the following setup, our Java application is able to connect to the SQL Server database:
    - SQL Server 2008 R2 SP2
    - Java 6 Update 27-33 or Java 7 Update 2-5
    just switching the JVM to the following would cause the application to be unable to connect to the database:
    - Java 6 Update 34 or 35, or Java 7 Update 6 or 7
    Browsing through the Java 6 Update 34 release notes, it looks like nothing big was changed, so I'm wondering what has changed with Java 6 U34 and Java 7 U6. I was also looking through a packet sniffer, and indeed the behavior of Java 6 Update 33 and lower was different from Java 6 Update 34 (although I couldn't understand the messages being passed, the number of connections and messages were different).
    * This is different from the issue with Java 6 Update 29-30 and Java 7 wherein they were patched for the BEAST SSL vulnerability. That was fixed with the SP2 patch for SQL Server 2008 R2, and for SQL Server 2008 you'd need a hotfix aside from SP3. After patching the server with those updates, Java 6 Update 29-33 and Java 7 U1-5 should be able to connect to the database.
    * If I do switch off Force Encryption, all Java versions are able to connect to the database.
    Edited by: user1357749 on Oct 12, 2012 1:20 AM

    Hi,
    It's four months later, but my colleague and I have reproduced the same behavior in both our commercial product, and a very simple example class. It's exactly as you describe it, where the latest versions of both Java 6 and 7 (and several previous versions) hang during the first jTDS SQL query to the DB (immediately after the SSL and handshake). It also happens with the Microsoft JDBC driver.
    If you disable the BEAST SSL fix (-Djsse.enableCBCProtection=false), then the connections work without any problems. So, while this is different from the original BEAST SSL problem and subsequent fix, it really seems like some additional changes were made to the fix in a later Java release that broke things.
    My colleague has filed a bug with Oracle, and is awaiting a response. We also filed a bug at the jTDS project (#690 - http://sourceforge.net/p/jtds/bugs/690/) that has simple reproduction steps. A contributer at the jTDS project agrees that this seems to be a problem with the JRE, and is not specific to jTDS.
    I hope that Oracle will address this issue soon. We need to periodically update the JRE due to vulnerabilities, and we need to have SSL for our JDBC connections for security reasons. This bug puts us and others in a difficult position.

  • Add jTDS to Connection Profile Types

    I am using Juno SR2 with the latest updates applied.
    How do I add jTDS to the Database Development (perspective)?
    Details:
    Using the SQL explorer I am able to connect to and run a select statement against a SQL database and get the correct results. This tells me that this part of the installation is working as expected.
    (Configured and working with jTDS)
    SQL Explorer (perspective)
    - Create New Connection Profile
    - - Add / Edit Drivers
    - - - jTDS appears in list with a check mark
    (Can't configure jTDS)
    Database Development (perspective)
    - Data Source Explorer
    - - Database Connection
    - - - (jTDS not in list and don't see a way to add it)
    I have copied jtds-1.3.0.jar to
    Eclipse/plugins/jTDS/
    Thank you for any help you can provide

    This topic has been opened for a long time but I post a solution here in case someone has the same issue.
    I could not add JTDS as a new driver definition for MS SQL Server (impossible to select it in the dropdown menu "Drivers").
    Then I checked the version of the "Other Driver" in "Window" - "Preferences" - "Data Management" - "Connectivity" - "Driver Definitions" and the "System Version" was "2008".
    I deleted it and tried to create a new one in the "Data Source Explorer" (right click on "Database Connection" and "New"). When I got to the "New Connection Profile" window, I selected "Other Driver - 2005" instead of "Other Driver - 2008" and I could configure normally my "New Connection Profile".
    I do not know why it did not work with the "2008" version but the most important is to have a solution

  • Connecting to MS SQL Server with JTDS DBC Driver version 11.1.58.17

    The version 1.5.4 supposed to allow you to connect to SQL Servers (JTDS DBC Driver version 11.1.58.17) but in fact you cannot. That is, even to SQL Express2005.
    The earlier JTDS could in fact supported connecting to SQL Server 2005 as well as SQL Express as I wrote in my earlier article,
    http://www.packtpub.com/article/oracle-sql-developer-tool-1.5-sql-server-2005
    The new driver does not enable the connection with similar syntax while connecting to SQL Server 2005. Is it a problem with the driver?

    Thanks a lot.
    That appears to be a good link. Why does this process have to be so convoluted? First of all the user is directed to something that is not going to work (I mean the Oracle's JTDS 11.1.58.17 stuff) and to use Source Forge you need to do further work. Does not make sense from the usability point of view, does it?
    Anyway is SQL Server 2008 is supported in this version?

  • -net.sourceforge.jtds.jdbc.Driver ERROR WHILE CONNECTING TO SQL SERVER

    Hi,
    While making a new connection to Sql Server Express Edition Database, through Oracle Sql Developer i am getting a problem when retrieving the database.The error is "-net.sourceforge.jtds.jdbc.Driver" .I have downloaded the "jTDS - SQL Server and Sybase JDBC driver " from sourceforge website, but i am confused about where to paste it.
    thanks.

    I'm not sure why you are having the error but I am sure of the following:
    1. This forum is not appropriate for SQL*Developer questions.
    2. Or questions about code from SourceForge
    3. Or Microsoft products.
    It seems unlikely this has anything to do with Oracle so I would recommend you find a forum related to the driver if one exists. Otherwise you can try the SQL*Developer forum but I would be there aren't more than a dozen other people on the product trying to do this.

  • SQL Exception while connecting to Jtds driver

    hi...can somebody help me with my error
    iam using "net.sourceforge.jtds.jdbc.Driver" with SQL Server 2000 on XP with tomcat version 4.0
    it gives me the following exception
    java.sql.SQLException: "Network error IOException: Connection refused: connect"
    can somebody help me urgent

    ya i tried telnet localhost 1433..still
    Connecting To localhost...Could not open connection to the host, on port 1433: Connect failed
    and when i use netstat -an the foll appears
    Active Connections
    Proto Local Address Foreign Address State
    TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:443 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:1027 0.0.0.0:0 LISTENING
    TCP 0.0.0.0:5101 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:1033 0.0.0.0:0 LISTENING
    TCP 192.168.1.2:139 0.0.0.0:0 LISTENING
    TCP 192.168.1.2:1138 216.155.193.140:5050 ESTABLISHED
    TCP 192.168.1.2:1151 68.142.233.167:443 ESTABLISHED
    TCP 192.168.1.2:1422 61.2.36.53:5101 ESTABLISHED
    TCP 192.168.1.2:1593 59.92.38.133:5101 ESTABLISHED
    TCP 192.168.1.2:1874 216.109.118.146:5001 ESTABLISHED
    TCP 192.168.1.2:2054 64.94.235.124:80 ESTABLISHED

  • Null connection when trying to connect to SQL Server 2000 in Tomcat4.1.29

    Hi All,
    I am still struggling with null connection when trying to connect to sql server 2000 with tomcat using sun.jdbc.odbc.JdbcOdbcDriver
    Here is my server.xml
    <Server port="8005" shutdown="SHUTDOWN" debug="0">
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
    debug="0"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
    debug="0"/>
    <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    </ResourceParams>
    <Resource auth="Container" description="Users and Groups
    Database" name="UserDatabase"
    scope="Shareable"
    type="org.apache.catalina.UserDatabase"/>
    <Resource name="jdbc/DefaultDS" scope="Shareable"
    type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.
    MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    </ResourceParams>
    <ResourceParams name="jdbc/DefaultDS">
    <parameter>
    <name>validationQuery</name>
    <value></value>
    </parameter>
    <parameter>
    <name>user</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>4</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:JBoss-SQL://localhost:1433;databaseName=Development;selectMethod=cursor;</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>2</value>
    </parameter>
    </ResourceParams>
    </GlobalNamingResources>
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Tomcat-Standalone">
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8080" minProcessors="5" maxProcessors="75"
    enableLookups="true" redirectPort="8443"
    acceptCount="100" debug="0" connectionTimeout="20000"
    useURIValidationHack="false" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
    to -1 -->
    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <!--
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8443" minProcessors="5" maxProcessors="75"
    enableLookups="true"
    acceptCount="100" debug="0" scheme="https" secure="true"
    useURIValidationHack="false" disableUploadTimeout="true">
    <Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
    clientAuth="false" protocol="TLS" />
    </Connector>
    -->
    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8009" minProcessors="5" maxProcessors="75"
    enableLookups="true" redirectPort="8443"
    acceptCount="10" debug="0" connectionTimeout="0"
    useURIValidationHack="false"
    protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
    <!-- Define an AJP 1.3 Connector on port 8009 --><Logger className="org.apache.catalina.logger.FileLogger"
    prefix="catalina_log." suffix=".txt"
    timestamp="true"/>
    <!-- Define the default virtual host -->
    <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    directory="logs" prefix="localhost_log." suffix=".txt"
    timestamp="true"/>
    <Environment name="maxExemptions" type="java.lang.Integer"
    value="15"/>
    <Parameter name="context.param.name" value="context.param.value"
    override="false"/>
    <Resource name="jdbc/DefaultDS" auth="container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/DefaultDS">
    <!-- Maximum number of dB connections in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxActive</name>
    <value>8</value>
    </parameter>
    <!-- Maximum number of idle dB connections to retain in pool.
    Set to 0 for no limit.
    -->
    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>
    <!-- Maximum time to wait for a dB connection to become available
    in ms, in this example 10 seconds. An Exception is thrown if
    this timeout is exceeded. Set to -1 to wait indefinitely.
    -->
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <!-- MS Sql Server dB username and password for dB connections
    -->
    <parameter>
    <name>user</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>
    <!-- Class name for MS Sql Server JDBC driver
    -->
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <!-- The JDBC connection url for connecting to MS Sql Server dB.
    -->
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:JBoss-SQL://localhost:1433;databaseName=Development;selectMethod=cursor;</value>
    </parameter>
    <!-- This Databae Connection Pool Description.
    -->
    <parameter>
    <name>description</name>
    <value>JDBC Driver: sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    </ResourceParams>
    <Resource name="mail/Session" auth="Container"
    type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
    <name>mail.smtp.host</name>
    <value>localhost</value>
    </parameter>
    </ResourceParams>
    <ResourceLink name="linkToGlobalResource"
    global="simpleValue"
    type="java.lang.Integer"/>
    </Host>
    </Engine>
    </Service>
    </Server>
    and my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <!-- Standard Action Servlet Mapping -->
    <web-app>
    <resource-ref>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    and JBoss-SQL is data source I created from control panel settings and here is way I am retrieving connetion
    InitialContext initCtx = new InitialContext();
    DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/DefaultDS");
    Connection con = ds.getConnection();
    return con;
    I tried connecting as mentioned in this website
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#Common%20Problems.But didn't help
    Please help urgent
    Sorry for long file. Can any one please help me in solving this problem.
    Thanks in advnace
    Kurakula

    I'd recommend that you not use the JDBC-ODBC bridge driver to connect to SQL Server. M$ and jTDS are two free type IV JDBC drivers that you should use instead. Put those JARs in the WEB-INF/lib directory.
    The database URL you're using is not correct if you change drivers. Consult the docs to find out what the proper syntax is.
    MOD

  • Sql developer won't connect with SQL server database on cluster

    Hello,
    I have a microsoft SQL server database on a windows cluster. Name for this cluster is like XXX/YYY
    When I try to connect to this database with SQL developer, I get a failure, mentioning:
    "Status : Failure -Cannot connect to Miscrosoft SQL Server on XXX/YYY"
    As far as I know, I have installed the correct jtds driver (version 1.2.5), since I can connect to sql server databases on single server hosts.
    Does anyone know how to connect to databases on windows clusters?
    Edited by: Ingmar on Jan 16, 2012 4:08 PM
    Edited by: Ingmar on Jan 16, 2012 4:22 PM

    Hi Ingmar,
    Try this is in the port box
    1433/dbname;instance=YYY
    dbname can be omitted
    -Turloch
    SQL Developer team
    1/Giving an instance name in SQLDeveloper connection to SQL Server (from August 2011)
    MS SQL Server Connection
    The correct syntax to deal with this is in the port box
    1433/dbname;instance=instance
    dbname can be omitted
    2/cluster configuration (uses instance name)
    http://stackoverflow.com/questions/1160024/jdbc-connect-string-for-sql-server-cluster
    where vvv\iii is the cluster address: jdbc address is:
    "jdbc:sqlserver://vvv;instanceName=iii"
    3/jtds url details available in
    http://jtds.sourceforge.net/faq.html

  • Help!: jTDS is not working on j2sdkee1.4!

    Hello there!
    I'm working with Win2k sp4, MS-Sql Server 7 and j2ee sdk 1.4 (the newest release).
    I'm trying to use the jTDS JDBC driver to access a MSSql database. This is the connection pool configuration:
    <jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="net.sourceforge.jtds.jdbcx.TdsDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="false" max-pool-size="32" max-wait-time-in-millis="60000" name="cmc" pool-resize-quantity="2" res-type="javax.sql.DataSource" steady-pool-size="8">
    <description>mydb</description>
    <property name="DatabaseName" value="mydb"/>
    <property name="LoginTimeout" value="6000"/>
    <property name="Password" value="mypass"/>
    <property name="User" value="myuser"/>
    <property name="PortNumber" value="1433"/>
    <property name="ServerName" value="localhost"/>
    </jdbc-connection-pool>
    I set up the configuration and restarted the server. I put the jtds-0.7.1.jar file on
    c:\sun\appserver\domains\domain1\lib folder (and nowhere else) and restarted the server. I've checked for the port 1433 and it's working fine.
    But when I ping the connection pool, I always get the same error: Operation 'pingConnectionPool' failed in 'resources' Config Mbean.
    I'm getting nuts trying to solve this problem and I don't get it!.
    Please, any help would be appreciatted!!
    Thanx

    Hey! Alin! Thankyou!
    I finally solved the problem with your responses!!!
    I downloaded the final RC version of jTDS (0.8). I copyed the JAR file in c:\sun\appserver\domains\domain1\lib
    The final configuration in the domain.xml is:
    <description>mydb</description>
    <property name="DatabaseName" value="mydb"/>
    <property name="LoginTimeout" value="6000"/>
    <property name="Password" value="mypass"/>
    <property name="User" value="myuser"/>
    <property name="PortNumber" value="1433"/>
    <property name="ServerName" value="localhost"/>
    <property name="Server_type" value="sqlserver"/> <--- VERY IMPORTANT
    <property name="Charset" value="Unidoce"/> <--- VERY IMPORTANT
    </jdbc-connection-pool>
    An now it's pinging without problems!!!
    My only concern is that "Unicode" is a valid value for the "charset" property.
    Regards!

  • Mildet connect to oracle DB using servlet problem ,help please

    hi guys i have a problem am tring to connect my midlet to databse through midlet but i don`t know what is the problem so far the midlet already connect to my servlet url but the servlet cant read the parameters to open the connection for database
    my servlet code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.text.*;
    * @author freddy
    public class getconnection extends HttpServlet {
        Statement statement;
    ResultSet rs=null;
    String bstr=null;
    String bstr1=null;
    String bstr2=null;
    public void init()
        * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
        * @param request servlet request
        * @param response servlet response
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                /* TODO output your page here
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet getConnection</title>"); 
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet getConnection at " + request.getContextPath () + "</h1>");
                out.println("</body>");
                out.println("</html>");
            } finally {
                out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        * Handles the HTTP <code>GET</code> method.
        * @param request servlet request
        * @param response servlet response
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
      doPost(request,response);
        * Handles the HTTP <code>POST</code> method.
        * @param request servlet request
        * @param response servlet response
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
            DataInputStream in = new DataInputStream(
                    (InputStream)request.getInputStream());
            String sid = in.readUTF();
            String user = in.readUTF();
            String pwd = in.readUTF();
          //  "jdbc:oracle:thin:@localhost:1521"+": "+sid
            String message = message = "Name:"+bstr+" telephone:"+bstr1+" burthday:"+bstr2;
             try {
                connect(sid,user, pwd);
                message += "100 ok connected";
            } catch (Throwable t) {
                message += "200 " + t.toString();
            response.setContentType("text/plain");
            response.setContentLength(message.length());
            PrintWriter out = response.getWriter();
            out.println(message);
            in.close();
            out.close();
            out.flush();
        private void connect(String sid, String user,String pwd)
        throws Exception {
            // Establish a JDBC connection to the MYSQL database server.
            //Class.forName("org.gjt.mm.mysql.Driver");
            Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
            Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:"+sid,user,pwd);
            System.out.print("connected");
            try{
               statement =conn.createStatement();
                rs=statement.executeQuery(" Select*from WOH.P_DEMGRAPHICS where P_ID='P1000 '");
            catch(SQLException e)
            System.err.print(e);
           try{
    while (rs.next()) {
    bstr=rs.getString(2);
    bstr1=rs.getString(3);
    bstr2=rs.getString(4);
    statement.close();
       catch (SQLException e) {
    //bstr += e.toString();
    System.err.println(e);
    System.exit(1);
            // Establish a JDBC connection to the Oracle database server.
            //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            //Connection conn = DriverManager.getConnection(
            //      "jdbc:oracle:thin:@localhost:1521:"+db,user,pwd);
            // Establish a JDBC connection to the SQL database server.
            //Class.forName("net.sourceforge.jtds.jdbc.Driver");
            //Connection conn = DriverManager.getConnection(
            //      "jdbc:jtds:sqlserver://localhost:1433/"+db,user,pwd);
        * Returns a short description of the servlet.
        public String getServletInfo() {
            return "Short description";
        // </editor-fold>
    }Midlet code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    * @author freddy
    public class testOrcl extends MIDlet  implements CommandListener {
       protected String url;
        private String username;
        private Display display;
        private Command exit = new Command("EXIT", Command.EXIT, 1);;
        private Command connect = new Command("Connect", Command.SCREEN, 1);
        private TextField tb;
        private Form menu;
        private TextField tb1;
        private TextField tb2;
        DB db;
        public testOrcl() throws Exception
            display=Display.getDisplay(this);
            url="http://localhost:8084/getConnection/getconnection";
        public void startApp() {
            displayMenu();
        public void displayMenu()
        menu= new Form("connect");
         tb = new TextField("Please input database: ","",30,
                    TextField.ANY );
            tb1 = new TextField("Please input username: ","",30,
                    TextField.ANY);
            tb2 = new TextField("Please input password: ","",30,
                    TextField.PASSWORD);
            menu.append(tb);
            menu.append(tb1);
            menu.append(tb2);
            menu.addCommand(exit);
            menu.addCommand(connect);
            menu.setCommandListener(this);
            display.setCurrent(menu);
        public void pauseApp() {
        public void destroyApp(boolean unconditional) { }
        public void commandAction(Command command, Displayable screen) {
            if (command == exit) {
                destroyApp(false);
                notifyDestroyed();
            } else if (command == connect) {
                db  = new DB(this);
                db.start();
                db.connectDb(tb.getString(),tb1.getString(),tb2.getString());
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.io.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.lang.*;
    * @author freddy
    public class DB implements Runnable  {
        testOrcl midlet;
         private Display display;
            String sid;
            String user;
            String pwd;
            public DB( testOrcl midlet)
            this.midlet=midlet;
            display=Display.getDisplay(midlet);
        public void start()
        Thread t = new Thread(this);
                t.start();
        public void run()
         StringBuffer sb = new StringBuffer();
                try {
                    HttpConnection c = (HttpConnection) Connector.open(midlet.url);
                   c.setRequestProperty(
                       "User-Agent","Profile/MIDP-2.1, Configuration/CLDC-1.1");
                    c.setRequestProperty("Content-Language","en-US");
                    c.setRequestMethod(HttpConnection.POST);
                    DataOutputStream os =
                            (DataOutputStream)c.openDataOutputStream();
                    os.writeUTF(sid.trim());
                    os.writeUTF(user.trim());
                    os.writeUTF(pwd.trim());
                    os.flush();
                    os.close();
                    // Get the response from the servlet page.
                    DataInputStream is =(DataInputStream)c.openDataInputStream();
                    //is = c.openInputStream();
                    int ch;
                    sb = new StringBuffer();
                    while ((ch = is.read()) != -1) {
                        sb.append((char)ch);
               showAlert(sb.toString());
                    is.close();
                    c.close();
                } catch (Exception e) {
                    showAlert(e.getMessage());
         /* This method takes input from user like db,user and pwd and pass
                to servlet */
            public void connectDb(String sid,String user,String pwd) {
                this.sid = sid;
                this.user = user;
                this.pwd = pwd;
            /* Display Error On screen*/
            private void showAlert(String err) {
                Alert a = new Alert("");
                a.setString(err);
                a.setTimeout(Alert.FOREVER);
                display.setCurrent(a);
       

    Comment out process request or rewrite & move it to a position after you read the parameters and connect to the db. Decide where you want to write to the output stream. Also, you have some superfluous casting.
    I take it that you are using netbeans? If you debug and step through the code you will get an idea of the flow. The steps should be, midlet connects with POST, doPost is called, server reads parameters, server opens connection, executes query, releases/closes connection, and writes a response to the midlet.
    Some notes about the connect method; The scope of rs may cause problems. It is unlike you will have a valid result set if you have a problem with create statement or execute. Take a look at connection pooling and be mindful how the connections are opened, used, and closed; put all the important cleanup operations in a finally. Remove system.exit from your servlet. Actually I would suggest limiting the scope of all your vars;
    If you store the username, password, and sid on the midlet, you may have trouble updating the installation base if you need to change the values for any reason. Also, you have clients which contain your database u/p, susceptible to snooping and decompilation. Use the servlet to abstract the db from the client. And use a datasource (with connection pooling) for obtaining connections to db.

Maybe you are looking for

  • Host command in forms 10g

    hi all i am using host command in forms 10g. but it is not executing . is there any distinct syntax or pre-requirement for executing this command kindly help thanks

  • JAVA Drawing Graphics Save as JPEG?

    My problem is this, I am trying to save my g2 graphic image to a jpg. This is how I have things setup, I will show code and my thoughts. What I need is help to figure out how I could save seperate .java files graphics g to the jpg format from a JFile

  • WDTV Live Plus and Time Capsule

    I just got a WDTV Live Plus and I love it.  The only problem is that I see the Apple Time Capsule and iMAC right away in the network shares, but I cannot get on them.  I wanted to see what the issue could be.  When I click them I am prompted for an a

  • Create video effect similar to 'virtual choir'

    I am using premiere pro and also after effects to try and make something similar to virtual choir effects in which multiple videos animate together in globes or we see it panning across a wall of moving videos. Can someone please point me in the dire

  • Unistalled firefox on windows vista now wont allow me to reinstall get error message windows cant find

    unistalled firefox due to ask.com toolbar when tried to reinstall firefox from already saved set up exe file windows states cannot find c:/user/jim/appdata/local/temp/7zSAD30.temp/setup exe make sure you typed the name correctly and try again. This s