Problem connecting JDBC with SQLServer 2005

* While executing the following JDBC code with SQLServer 2005, it throws Exception
* I dont wts wrong in my code, (Note: I have included the sqljdbc.jar in my path)
* Pls let me know the problems in my code
* Thanks, Following is my code and error
CODE:
import java.sql.*;
public class JDBCwithJava {
     public void work() {
           // Create a variable for the connection string.
           String connectionUrl = "jdbc:sqlserver://localhost:1433;" +"databaseName=empdb";
           // Declare the JDBC objects.
           Connection con = null;
           Statement stmt = null;
           ResultSet rs = null;
           try {
                //Load the driver
              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
              // Establish the connection.
              con = DriverManager.getConnection(connectionUrl);
              System.out.println("Database Successfully Connected...!");
              //Connection Info
              DatabaseMetaData dm = con.getMetaData();
             System.out.println("Driver Information");
             System.out.println("\t Driver Name: "+ dm.getDriverName());
             System.out.println("\t Driver Version: "+ dm.getDriverVersion ());
             System.out.println("\n Database Information ");
             System.out.println("\t Database Name: "+ dm.getDatabaseProductName());
             System.out.println("\t Database Version: "+ dm.getDatabaseProductVersion());
              // Create and execute an SQL statement that returns some data.
              String SQL = "select  * from emptable";
              stmt = con.createStatement();
              rs = stmt.executeQuery(SQL);
              // Iterate through the data in the result set and display it.
              while (rs.next()) {
                 System.out.println(rs.getInt(1) + " " + rs.getString(2));
           // Handle any errors that may have occurred.
           catch (Exception e) {
              e.printStackTrace();
           finally {
              if (rs != null)
                   try {
                        rs.close();
                  catch(Exception e) {
              if (stmt != null) try { stmt.close(); } catch(Exception e) {}
              if (con != null) try { con.close(); } catch(Exception e) {}
     public static void main(String ar[]){
          JDBCwithJava call = new JDBCwithJava();
          call.work();
OUTPUT with ERROR:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection refused: connect
     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
     at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
     at java.sql.DriverManager.getConnection(Unknown Source)
     at java.sql.DriverManager.getConnection(Unknown Source)
     at JDBCwithJava.work(JDBCwithJava.java:17)
     at JDBCwithJava.main(JDBCwithJava.java:58)* Please give me your suggestion about the above program.........

JavaImran wrote:
RoyGrini wrote :
Looks like login problems. Username/password or windows authentication logon problem.        * I didnt give any UN and Pwd for my database.........And the
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)gives you a 'connection refused'
Try with providing a SQL username/password. Maybe that will work
- Roy

Similar Messages

  • Issue with configuring Hyperion HUB 7.1.2 with SQLSERVER 2005

    Hello Experts,
    One of my customer has an issue with configuring Hyperion HUB 7.1.2 with SQLSERVER 2005.
    "We are trying to configure the SQL server 2005 database with Hyperion hub and we are unable to get the cofiguration completed. We suspect the driver class (hyperion.jdbc.sqlserver.SQLServerDriver) used in the domain.xml (path \Hyperion\HyperionHub\7.2.1\deployments\Tomcat\4.1.30\) is not helping to connect with sql server 2005. We would appreciate if you can provide new driver class which we can included while deploying the app under the web server."
    Please suggest. Thanks in advance
    Regards,
    Sonu

    Hi
    Please redeploy only the Web Server under shared service. It has to be redeployed once EPMA and others are configured.
    Thanks
    Rupak
    Mantra to Win | WinMantras.com | http://hyperion.winmantras.com

  • I have a problem connecting Muse with business catalyst.

    I have a problem connecting Muse with business catalyst. When I start the publication is presented with the following message: Timeout when accessing with Adobe ID. Check your network connection and try again. But the connection is working properly.

    Hi Federico,
    Please go to Edit > Preferences in Muse and make sure the "Publish with Account" has the creative cloud subscription Adobe ID.
    Regards,
    Aish

  • JDBC with MSSQL 2005 -- problem connecting

    Hi, I have setup JDBC and I am able to connect to a MySQL database just fine. But I can't connect to MSSQL SQLExpress 2005.
    I got the sqljdbc.jar file placed it under the LiveCycle8\jboss\server\all\lib folder and setup the Datasource file as:
        MSSQLDS    jdbc:sqlserver://LIVECYCLE\SQLEXPRESS:1433;databaseName=MyDBName
    com.microsoft.sqlserver.jdbc.SQLServerDriver
        username
        password
             MS SQLSERVER2005
    Then I modified the login-config.xml and added the application-policy as:
                   username
                   password
                   jboss.jca:service=LocalTxCM,name=MSSQLDS
    Then in LC connection, setup the string to java:/MSSQLDS
    When running the test query b I get NO Response At All.  And I mean, even if I intentionally change the datasource file to hold incorrect information, I'll get no response. However, I can connect to MySQL without any problems.
    b Any ideas?
    Thanks for any help!

    JavaImran wrote:
    RoyGrini wrote :
    Looks like login problems. Username/password or windows authentication logon problem.        * I didnt give any UN and Pwd for my database.........And the
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)gives you a 'connection refused'
    Try with providing a SQL username/password. Maybe that will work
    - Roy

  • Problem while working  with sqlserver

    hello
    i am a user of jdeveloper using swing/jclient in my application.
    i am using sqlserver with my jdeveloper. i had followed the path necessary for foreign database.
    i had made a connection with sqlserver . connection is created.
    but when i test my applicationmodule . i am able to insert the data and save it.but when i tried to delete or update any record it is throwing an error:
    (oracle.jbo.DMLException) JBO-26080: Error while selecting entity for Trial
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]FOR UPDATE cannot be specified on a READ ONLY cursor.
    details:
    oracle.jbo.DMLException: JBO-26080: Error while selecting entity for Trial
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:653)
         at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:4480)
         at oracle.jbo.server.EntityImpl.lock(EntityImpl.java:3033)
         at oracle.jbo.server.ViewRowImpl.lockEntities(ViewRowImpl.java:1506)
         at oracle.jbo.server.ViewRowImpl.doRemove(ViewRowImpl.java:1631)
         at oracle.jbo.server.ViewRowImpl.remove(ViewRowImpl.java:1683)
         at oracle.jbo.server.QueryCollection.doRemove(QueryCollection.java:1176)
         at oracle.jbo.server.QueryCollection.remove(QueryCollection.java:1195)
         at oracle.jbo.server.ViewRowSetImpl.removeRowAt(ViewRowSetImpl.java:1423)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doRemoveCurrentRow(ViewRowSetIteratorImpl.java:2044)
         at oracle.jbo.server.ViewRowSetIteratorImpl.removeCurrentRow(ViewRowSetIteratorImpl.java:2065)
         at oracle.jbo.server.ViewRowSetImpl.removeCurrentRow(ViewRowSetImpl.java:2112)
         at oracle.jbo.server.ViewObjectImpl.removeCurrentRow(ViewObjectImpl.java:5477)
         at oracle.jbo.jbotester.NavBar$rsDelete.doAction(NavBar.java:400)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:60)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:227)
         at java.awt.Component.processMouseEvent(Component.java:5134)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    ## Detail 0 ##
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]FOR UPDATE cannot be specified on a READ ONLY cursor.
         at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown Source)
         at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
         at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
         at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:530)
         at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:4480)
         at oracle.jbo.server.EntityImpl.lock(EntityImpl.java:3033)
         at oracle.jbo.server.ViewRowImpl.lockEntities(ViewRowImpl.java:1506)
         at oracle.jbo.server.ViewRowImpl.doRemove(ViewRowImpl.java:1631)
         at oracle.jbo.server.ViewRowImpl.remove(ViewRowImpl.java:1683)
         at oracle.jbo.server.QueryCollection.doRemove(QueryCollection.java:1176)
         at oracle.jbo.server.QueryCollection.remove(QueryCollection.java:1195)
         at oracle.jbo.server.ViewRowSetImpl.removeRowAt(ViewRowSetImpl.java:1423)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doRemoveCurrentRow(ViewRowSetIteratorImpl.java:2044)
         at oracle.jbo.server.ViewRowSetIteratorImpl.removeCurrentRow(ViewRowSetIteratorImpl.java:2065)
         at oracle.jbo.server.ViewRowSetImpl.removeCurrentRow(ViewRowSetImpl.java:2112)
         at oracle.jbo.server.ViewObjectImpl.removeCurrentRow(ViewObjectImpl.java:5477)
         at oracle.jbo.jbotester.NavBar$rsDelete.doAction(NavBar.java:400)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:60)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:227)
         at java.awt.Component.processMouseEvent(Component.java:5134)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    ----- LEVEL 1: DETAIL 0 -----
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]FOR UPDATE cannot be specified on a READ ONLY cursor.
         at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
         at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown Source)
         at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
         at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
         at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
         at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:530)
         at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:4480)
         at oracle.jbo.server.EntityImpl.lock(EntityImpl.java:3033)
         at oracle.jbo.server.ViewRowImpl.lockEntities(ViewRowImpl.java:1506)
         at oracle.jbo.server.ViewRowImpl.doRemove(ViewRowImpl.java:1631)
         at oracle.jbo.server.ViewRowImpl.remove(ViewRowImpl.java:1683)
         at oracle.jbo.server.QueryCollection.doRemove(QueryCollection.java:1176)
         at oracle.jbo.server.QueryCollection.remove(QueryCollection.java:1195)
         at oracle.jbo.server.ViewRowSetImpl.removeRowAt(ViewRowSetImpl.java:1423)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doRemoveCurrentRow(ViewRowSetIteratorImpl.java:2044)
         at oracle.jbo.server.ViewRowSetIteratorImpl.removeCurrentRow(ViewRowSetIteratorImpl.java:2065)
         at oracle.jbo.server.ViewRowSetImpl.removeCurrentRow(ViewRowSetImpl.java:2112)
         at oracle.jbo.server.ViewObjectImpl.removeCurrentRow(ViewObjectImpl.java:5477)
         at oracle.jbo.jbotester.NavBar$rsDelete.doAction(NavBar.java:400)
         at oracle.jbo.jbotester.AbstractJboAction.actionPerformed(AbstractJboAction.java:60)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:227)
         at java.awt.Component.processMouseEvent(Component.java:5134)
         at java.awt.Component.processEvent(Component.java:4931)
         at java.awt.Container.processEvent(Container.java:1566)
         at java.awt.Component.dispatchEventImpl(Component.java:3639)
         at java.awt.Container.dispatchEventImpl(Container.java:1623)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
         at java.awt.Container.dispatchEventImpl(Container.java:1609)
         at java.awt.Window.dispatchEventImpl(Window.java:1590)
         at java.awt.Component.dispatchEvent(Component.java:3480)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    Please do help if you can.
    Thanks in Advance
    Aparna

    thanks shay
    but i had gone through all the steps. i had also set the oracle.jbo.locking mode to optimistic
    but then also i am getting the same error while updating and deleting.
    Please do help me if you ca.
    thanks
    Aparna

  • Problem connecting wirelessly with home hub 3.

    Kodak gave me advice onthis problem. Entered security key in upper case instead of lower and it solved the problem . No help from BT on this.

    paulweekspat wrote:
    trying to connect kodak printer. i have resolved the issue with help from kodak. bt was no help at all. thanks anyway.
    What john46 says is quite correct, also Kodak would give you NO support for setting up the Home Hub..
    Thats not to say you would not have been given help on these forums if you had a problem connecting your printer and if we could not help,at least we might have been able to point you in the right direction.
    http://support.en.kodak.co.uk/app/home/selected/true
    toekneem
    http://www.no2nuisancecalls.net
    (EASBF)

  • Problem connecting ipod with dvd

    Hi. I have an ipod nano. Before installing software version 1.2 I could connect it with my dvd via usb and manage it as a external disk, but after installing ipod software version 1.2 my dvd does not recognize ipod when I connect it via usb. I also have an ipod video with the same software and have the same problem. Anyone could help me?.
    Thanks.

    If you have a new enough iPod, they are now requiring an apple adapter that has the apple computer chip in it to work. I did a general search on the web and came up with better info than here.

  • Problem connecting AppleTV with ethernet

    I have an AppleTV2 that works perfectly connected to Wifi,  but if I connect via Ethernet, it cant find my ITunes Library on my computer. The AppleTv still is able to stream from the internet and is connected to the Internet but does not find any computers on the network. Also my iphone cannot find my AppleTV.  If I unplug the ethernet cord and go on the wifi, it has no problem connecting. How can I connect via ethernet and see my ITunes library?
    Here is the setup of my network: I have an iMac, connected via ethernet to Airport Extreme. The Airport Extreme is connected via Ethernet to a Motorola router that I am using as a switch that is in my basement. The Motorola router is then connected via ethernet to a switch that is connected to my AppleTv as well as a few other devices. All the devices connected have no problem finding the Internet connection.

    Try connecting the Apple TV 2 to the airport extreme. My setup is an iMac , iPad and two iPhones connected wirelessly via airport extreme. My apple tv 2 is connected via Ethernet to the airport extreme. It all works fine and have had no issues.

  • Problem: connect DB with Applet by JDBC-ODBC bridge

    Dear all,
    When I connect local MS SQL server by "sun.jdbc.odbc.JdbcOdbcDriver" as below, it works well! However, when I put the similar code under Java Applet program, it cannot run by showing error:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1501)
    at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:169)
    I think Java Applet has some security policy when I try to use applet to connect(read/write) DB. How can I solve it so that I can browse my applet under IE.
    Thanks a lot!
    Here is my worked code in Java program but not in Applet:
    import java.sql.*;
    public class TestJDBC1 {
    public static void main(String args[]) throws Exception {
    String userid = "";
    String password = "";
    // Register the driver with DriverManager
    new sun.jdbc.odbc.JdbcOdbcDriver();
    // Get a connection
    Connection conn = DriverManager.getConnection("jdbc:odbc:rdr",
    userid, password);
    // Create a statement for executing SQL
    Statement stmt = conn.createStatement();
    // Execute a query / SELECT statement
    ResultSet rset = stmt.executeQuery("SELECT * FROM PlatformNode");
    ResultSetMetaData rsmd = rset.getMetaData();
    // Find out how many columns were returned by the query
    int count = rsmd.getColumnCount();
    // Loop until all rows have been processed
    while (rset.next()) {
    // Loop until all columns in current row have been processed
    for (int i = 1; i <= count; i++) {
    // Print out the current value
    System.out.print(rset.getObject(i));
    // Put a comma between each value
    if (i < count) {
    System.out.println(",");
    // Start the next row's values on a new line
    System.out.println("");
    // Close the database objects
    rset.close();
    stmt.close();
    conn.close();

    Hi,
    Applets by default are restricted from accessing a lot of things.to enable applest from accessing database and other thngs u need to edit the policy file
    Try this.
    go to the jre/bin directory open the policytool.exe file
    and add permission(in ur case RuntimePermission to access class in package sun.jdbc.odbc) and save the file.
    this will enable applets from accessing the databse.
    Hope that helps
    Note:
    policytool.exe must be used to open the java.policy file present in /jre/lib/security directory and then add the permissions
    regards,
    Partha

  • Problems: connect DB with Applet by JDBC-ODBC bridge

    Dear all,
    When I connect local MS SQL server by "sun.jdbc.odbc.JdbcOdbcDriver" as below, it works well! However, when I put the similar code under Java Applet program, it cannot run by showing error:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1501)
    at sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:169)
    I think Java Applet has some security policy when I try to use applet to connect(read/write) DB. How can I solve it so that I can browse my applet under IE.
    Thanks a lot!
    Here is my worked code in Java program but not in Applet:
    import java.sql.*;
    public class TestJDBC1 {
    public static void main(String args[]) throws Exception {
    String userid = "";
    String password = "";
    // Register the driver with DriverManager
    new sun.jdbc.odbc.JdbcOdbcDriver();
    // Get a connection
    Connection conn = DriverManager.getConnection("jdbc:odbc:rdr",
    userid, password);
    // Create a statement for executing SQL
    Statement stmt = conn.createStatement();
    // Execute a query / SELECT statement
    ResultSet rset = stmt.executeQuery("SELECT * FROM PlatformNode");
    ResultSetMetaData rsmd = rset.getMetaData();
    // Find out how many columns were returned by the query
    int count = rsmd.getColumnCount();
    // Loop until all rows have been processed
    while (rset.next()) {
    // Loop until all columns in current row have been processed
    for (int i = 1; i <= count; i++) {
    // Print out the current value
    System.out.print(rset.getObject(i));
    // Put a comma between each value
    if (i < count) {
    System.out.println(",");
    // Start the next row's values on a new line
    System.out.println("");
    // Close the database objects
    rset.close();
    stmt.close();
    conn.close();

    ur question has just been answered under the java programming section

  • Having problems connecting Coldfusion10 with sql server express 2012

    Hi,
    I am having problems setting up a datasource for a local sql express 2012 server. Its running as the default instance. Connections are working with ODBC and client told just not Coldfusion.
    When I try to set up a connection using the sql driver I get this error:
    Connection verification failed for data source: Leaf
    java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]Error establishing socket to host and port: 127.0.0.1:1433. Reason: Invalid argument: connect
    The root cause was that: java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]Error establishing socket to host and port: 127.0.0.1:1433. Reason: Invalid argument: connect
    When I try a Socket connection with an ODBC connection I setup in windows I get this error:
    Connection verification failed for data source: LeafDB
    java.sql.SQLException: [Macromedia][SequeLink JDBC Driver]Internal network error, connection closed.
    The root cause was that: java.sql.SQLException: [Macromedia][SequeLink JDBC Driver]Internal network error, connection closed.
    Any ideas?
    Thanks,

    Hi Rossco199,
    The issue is likely caused by you not having yet assigned port 1433 in SQL Express itself. Follow the procedure described on the following page, and you should solve the problem: http://www.tensixconsulting.com/2012/02/sqlserverexception-the-tcpip-connection-to-the-hos t-port-1433-has-failed/
    In particular, remember to assign port 1433 to 127.0.0.1 and to IPAll. Also set 'Active' and 'Enabled' to 'Yes' for the IP 127.0.0.1. While you're at it, if 'Named Pipes' is disabled, you should right-click on it and select 'enable'. Afterwards, restart the Windows service 'SQL Server(SQLEXPRESS)'.
    It is advisable to allow ColdFusion server authentication. However, the SQL Express server is configured by default to allow only Windows authentication. This conflict may lead to errors.
    Should you then encounter the dreaded Error 233: "No process is on the other end of the pipe", proceed as follows. Open the tool Microsoft SQL Server Management Studio. Right-click on the name of your database server, then on Properties. In the user interface that opens, click on Security. Select the combined 'SQL Server and Windows Authentication mode'. Restart the service 'SQL Server(SQLEXPRESS)'.

  • ApplyChanges Problem in RowSet with SQLServer

    Hi
    I m using CachedRowSet and trying to update,insert and delete operation on it.When i try to update in the database by calling applyChanges(cn) then the following exception arises.
    Rememnber this problem is with Microsoft SQLServer.Same operations are executing successfully with Oracle Database.
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
         at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source)
    I m wiating for your reply.
    Good Bye
    Abdul Qadeer

    That is, you have to say SelectMethod=Cursor in the connection URL.

  • Error connecting jdbc with SQL server

    Hi,
    I get the following error when I try to run a sample program to connect SQLserver with JDBC . The driver I used to connect is " com.microsoft.jdbc.sqlserver.SQLServerDriver ".
    I have registered the driver properly but have problem in connecting to JDBC.
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at Test.main(Test.java:12)
    pls help
    Thanks in advance

    Well there is something wrong with your database URL you are giving to the driver. You should lookup the documentation for the driver and see what format the URL should be in.
    Here is an open source driver you could try too -- http://jtds.sourceforge.net/

  • Problem connecting wirelessly with HP 6310 printer

    Since our computer automatically updated from Windows 8 to 8.1 a couple of weeks ago, we have not been able to use our HP 6310 printer.  It connects with the computer through a wireless internet router.  Have updated the HP driver to 8.1 to no avail.  Any suggestions would be appreciated.  Thanks.

    Hey there @Benjie18 ,
    I read your post about how you cannot use your Officejet 6310 printer since upgrading to Windows 8.1. I have a few ideas that come to mind that I am going to suggest and I hope they help!
    1. Run the Print and Scan Doctor, which may find the problem and correct it.
    2. Make sure the printer can make copies.
    3. Try Uninstalling the Printer Software, restarting the PC and reinstall - HP Photosmart and Officejet Full Feature Software and Drivers
    Let me know the results. If you run into any issues or errors, let me know!
    Have a great day!
    R a i n b o w 7000I work on behalf of HP
    Click the “Kudos Thumbs Up" at the bottom of this post to say
    “Thanks” for helping!
    Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution!

  • Problem connecting mobile with PC by cable

    Hello, I'm a Nokia 3110 classic user. I have a problem with the connection from my 3110 classic to the PC. I use a Mini-USB cable (from my HP digicam). After I updated my PC Suite nothing works anymore. Reinstalling doesn't help, too. When I connect my mobile with the PC the driver installation assistant of Windows XP appears but the installation fails because there's a problem with the 'Nokia Phone Parent Driver'. What can I do? Plz help me to solve this problem :-(
    I know it's a bit imprecise but I hope for support :-)
    System:
    Windows XP SP2
    Nokia 3110 classic
    Connecting with connection cable
    Message Edited by dernamenlose on 24-Apr-2008 08:55 PM

    Nokia really need to sort this out. I too have the same problem, and posted in this same forum less than an hour ago!
    /discussions/board/message?board.id=connectivity&t​hread.id=15355
    Message Edited by basmic on 24-Apr-2008 08:12 PM
    5800 v20.0.012 -- 6500s v9.40 -- 6233 v5.43 -- 5140 v3.13

Maybe you are looking for