Having problem while connecting to SQL Server through a application

hi guys ,
having one problem while connecting to the SQL SERVER 2008 R2 through a application (Dynamics NAV), by using the concept of Linked Server.
But one more thing , i am able to access that very SQL server through my app , when i am working locally , i mean to say that when i am working on the machine itself on which the server is installed then its working fine .
But when i am working on another system the query doesn't work.

by using the concept of Linked Server.
Why through a linked server and not directly as a simple remote connection? I don't think you app is aware of linked server.
Olaf Helper
[ Blog] [ Xing] [ MVP]

Similar Messages

  • Error while connecting to SQL SERVER from OWB

    HI All,
    I got the following error while connecting to SQL SERVER from OWB(10gR2).
    1). Created DSN with (GMSCADA)
    2). tnsnames file is updated with the following information
    GMSCADA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.60.29)(PORT = 1433))
    (CONNECT_DATA =
    (SERVICE_NAME = SA)
    3). Tried to connect to SQL SERVER frm OWB
    Username: sa
    password: sa
    host: 172.16.60.29
    port: 1433
    service name: GMSCADA
    schema: sa
    I got the following error, when I click Test Connection:
    ORA-28545: error diagnosed by Net8 when connecting to an agent
    Unable to retrieve text of NETWORK/NCR message 65535
    ORA-02063: preceding 2 lines from OWB_3095
    Regards,
    Kumar.

    Hi David,
    What is Gateway, How I have to setup, Please let me know.
    I tried according to the Demo, But still I am facing the same problem. Which system IP I have to put in the host details.
    Can u please let me know.
    Regards,
    Kumar.

  • Trouble shooting while connecting Ms SQL Server 2008

    hi everyone i ve a trouble shooting while connecting to sql server. my whole sql connection code is here. i m using windows 7 64bit. i ve download jdk for 64bit and download jdbc driver too. in the jdbc driver folder i ve copied sqljdbc.jar file in to C:\Program Files\Java\jre6\lib\ext then i ve copied to C:\Program Files\Java\jdk1.6.0_19\jre\lib\ext then C:\Program Files (x86)\Java\jre6\lib\ext. i m not sure to where to copy. also finally i ve copied sqljdbc_auth.dll file in to C:\Windows\System32. there r two sqljdbc_auth.dll files one is 32bit other one is 64bit i checked to c folder and i see there r two microsoft sql server folders one is under program files one is under programfiles(x86). i just copied sqljdbc_auth.dll 64bit version in to system32 folder. i just found these infos from internet. i m new in java. when i run the program i get an error message which is :
    java.sql.SQLException: No suitable driver found for JDBC:sqlserver://localhost;java_data
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at ClientQuery.<init>(ClientQuery.java:31)
    at TicketSale.<init>(TicketSale.java:68)
    at TicketSale.main(TicketSale.java:409)
    the name of the database i want to connect is java_data which i made in sql server. can anyone tell me where did i made wrong?
      import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.ArrayList; public class ClientQuery {    // class begin private static final String URL ="JDBC:sqlserver://localhost;java_data"; private static final String USERNAME ="root"; private static final String PASSWORD = " "; private Connection connection = null; private PreparedStatement selectAllClient = null; private PreparedStatement selectClientbyAirline = null; private PreparedStatement insertNewClient = null; // person query constructor begin public ClientQuery (){ try { try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } connection = DriverManager.getConnection( URL, USERNAME, PASSWORD ); selectAllClient = connection.prepareStatement("SELECT * FROM Ticket"); selectClientbyAirline = connection.prepareStatement("SELECT * FROM Ticket WHERE airline = ?"); insertNewClient = connection.prepareStatement("INSERT INTO Ticket "+ "(name,surname,airline,flight_no,departure_date,departure_city,arrival_city,departure_time,arrival_time,gate,price)" + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); } // end try catch (SQLException sqlException) { sqlException.printStackTrace(); System.exit(1); } // end catch }  // person query constructor end // select all client in database public List <Client> getAllClient() { List<Client> results = null; ResultSet resultSet = null; try { resultSet = selectAllClient.executeQuery(); results = new ArrayList<Client>(); while (resultSet.next()) { results.add(new Client(     resultSet.getString("name"),     resultSet.getString("surname"),     resultSet.getString("airline"),     resultSet.getString("flight_no"),     resultSet.getString("departure_date"),     resultSet.getString("departure_city"),     resultSet.getString("arrival_city"),     resultSet.getString("departure_time"),     resultSet.getString("arrival_time"),     resultSet.getString("gate"),     resultSet.getString("price"))); }  // end while }  // end try catch (SQLException sqlException ) { sqlException.printStackTrace(); }  // end catch finally { try{ resultSet.close(); } // end try catch (SQLException sqlException) { sqlException.printStackTrace(); close(); }  // end catch }  //end finally return results; } // end of get all client method // select Client by Airline public List <Client> getClientbyAirline(String name ) { List<Client> results = null; ResultSet resultSet = null; try {             selectClientbyAirline.setString(1, name);              resultSet = selectClientbyAirline.executeQuery();             results = new ArrayList<Client>();                         while (resultSet.next()) { results.add(new Client(     resultSet.getString("name"),     resultSet.getString("surname"),     resultSet.getString("airline"),     resultSet.getString("flight_no"),     resultSet.getString("departure_date"),     resultSet.getString("departure_city"),     resultSet.getString("arrival_city"),     resultSet.getString("departure_time"),     resultSet.getString("arrival_time"),     resultSet.getString("gate"),     resultSet.getString("price"))); }  // end while     } // end try catch (SQLException sqlException) { sqlException.printStackTrace(); }  // end catch finally { try{ resultSet.close(); } // end try catch (SQLException sqlException) { sqlException.printStackTrace(); close(); }  // end catch }  //end finally return results; }    // end of select by airline method public int addClient(String name, String surname, String airline, String flight_no, String departure_date, String departure_city, String arrival_city, String departure_time, String arrival_time, String gate, String price) { int result = 0; try { insertNewClient.setString(1, name); insertNewClient.setString(2, surname); insertNewClient.setString(3, airline); insertNewClient.setString(4, flight_no); insertNewClient.setString(5, departure_date); insertNewClient.setString(6, departure_city); insertNewClient.setString(7, arrival_city); insertNewClient.setString(8, departure_time); insertNewClient.setString(9, arrival_time); insertNewClient.setString(10, gate); insertNewClient.setString(11, price); result = insertNewClient.executeUpdate(); }  // end try catch (SQLException sqlException) { sqlException.printStackTrace(); close(); }  // end catch return result; } // end of add Client method public void close () { try { connection.close(); }  // end try catch (SQLException sqlException) { sqlException.printStackTrace(); }  // end catch }  // end close method } // class end  

    Your URL string is, apparantly, incorrect. See the driver documentation.

  • -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.

  • Problem to connect the SQL -Server

    Hi Friends !!
    I am using SQL Server as back end.till today its working as fine.today while connecting to the server suddenly its giving error as "Problem occured java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed. The maximum simultaneous user count of 10 licenses for this 'Standard Edition' server has been exceeded. Additional licenses should be obtained and installed or you should upgrade to a full version. ".i am not getting ,what is the problem.if anybody knows please help me.
    thanx in advance ...........prabhakar

    Just try restarting the sql derver or re-creating the DSN. I know, it's not logical, but it just might work.

  • Problem with connection to SQl Server ( charecter set cp1255 not found )

    Hello my name is Ron ,
    i want to connect to SQL SERVER with the microsoft driver
    from Java ( with jDeveloper ) .
    then i did the following steps:
    1) i download and install the jdbc driver for Sql server
    on my machine ( windows XP with , JDK 1.3 )
    2) i update my classpath with the .Jar lib file of the driver .
    3) when creating the connection
    i'm using the
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    this is Ok , the driver was loaded .
    4) when trying the GetConnction
    Connection conn = DriverManager.getConnection
    ("jdbc:microsoft:sqlserver://server1:1433","username","secret");
    i get the following error:
    [Microsoft][SQLServer 2000 Driver for JDBC]Character set CP1255 not found in com.microsoft.util.transliteration.properties.
    please help me with this . any idea ?
    thanks in advance
    Roni

    Ron,
    Try following this document
    http://otn.oracle.com/products/jdev/howtos/bc4j/bc_psqlserverwalkthrough.html
    from the how-tos archive.
    Also, try to change the compiler encoding to UTF-8. you do this in the project setting window.
    http://otn.oracle.com/products/jdev/htdocs/vcmigration/weblogic/unicode.gif
    http://otn.oracle.com/products/jdev/htdocs/vcmigration/weblogic/unicode2.gif
    good luck

  • Problem with connect to sql server ..

    I have problem with connect to sql server2005
    i use jpa(hibernate) and jsf
    javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    root cause
    javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1371)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)
    org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost;databaseName=MIS
    java.sql.DriverManager.getConnection(Unknown Source)
    java.sql.DriverManager.getConnection(Unknown Source)
    org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:173)
    org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:276)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
    persistance.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="PrzychodnieLekarskiePU" transaction-type="RESOURCE_LOCAL">
    <class>model.Przychodznia</class>
    <properties>
    <property name="hibernate.connection.username" value="a"/>
    <property name="hibernate.connection.password" value="a"/>
    <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
    <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="javax.persistence.jdbc.user" value="a"/>
    <property name="javax.persistence.jdbc.password" value="a"/>
    <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    </properties>
    </persistence-unit>
    </persistence>
    Edited by: 985713 on 2013-02-02 07:12
    Edited by: 985713 on 2013-02-02 07:37

    it works ok : I don't known where is error in jpa .. ?
    public class MyConnection {
         public static Connection getConnection () throws SQLException{
              String url = "jdbc:sqlserver://ABADDON1;databaseName=MIS";
              String user = "a";
              String pass = "a";
              DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
              Connection conn = DriverManager.getConnection(
                        url,user,pass);
              System.out.println("OK");;
              return conn;
    try {
                   conn = MyConnection.getConnection();
                   } catch (SQLException ex) {
                        System.out.println("Error: " + ex.getErrorCode()
                                  + ex.getMessage());
                   }

  • Problem with Connection to SQL Server via Servlet (in iPlanet 6 App Server)

    Hi ,
    I am using the iPlanet ApplicationServer 6.0 SP2 for development & testing of an internet application.
    I am facing a problem when I am trying to connect to MS SQL SERVER via the native jdbcodbc driver (obdc32.dll). The error is something like this :
    [26/Jul/2001 11:50:35:7] warning: DriverConnect: (28000): [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '\'.(DB Error: 18456)
    [26/Jul/2001 11:50:35:7] warning: ODBC-027: CreateConn: failed to create connection [new connection]: DSN=fadd,DB=cashbook,USER=test,PASS=xxxxxxxxx
    [26/Jul/2001 11:50:35:7] error: DATA-108: failed to create a data connection wit
    h any of specified drivers
    Error in connecting to the Database for cirrus :java.sql.SQLException: failed to
    create a data connection with any of specified drivers
    java.sql.SQLException: failed to create a data connection with any of specified
    drivers
    at com.netscape.server.jdbc.Driver.afterVerify(Unknown Source)
    at com.netscape.server.jdbc.Driver.connect(Unknown Source)
    at com.netscape.server.jdbc.DataSourceImpl.getConnection(Unknown Source)
    at gefa.util.DBConnection.jdbcConnectionOpen(DBConnection.java:65)
    at gefa.servlet.ServUpload.doPost(ServUpload.java:45)
    at gefa.servlet.ServUpload.doGet(ServUpload.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    I have configured a DSN with the name "fadd" on the machine with the application server and it used NT authentication. I have supplied an NT userid and password that has appropriate rights on the database "cashbook".
    When I write a java standalone program, it does connect but via a servlet it does not connect.
    Can some guide me with this problem please ?
    Anything one might have observed in the past ? (may be specific to iPlanet ?)
    Thanks a lot in advance
    ~Sunil

    I'm using iPlanet App server as well and experiencing similar problem. I load my SQL Server driver by Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"), then use DriverManager.getDriver() to obtain the Driver.
    However, the Driver returned is not the SQLServerDriver as expected. The Driver returned is com.netscape.server.jdbc.Driver! And then when I do Driver.getConnection("jdbc:microsoft:sqlserver://MyServer"), it throws an SQLException saying that it doesn't accept a jdbc:microsoft:sqlserver subprotocol. Well, of course it doesn't, it's not a microsoft Driver at all.
    I suspect the problem is that the netscape Driver's acceptsURL() method ALWAYS returns true in iPlanet app server, thus when you getDriver(), the netscape Driver is always returned (and always returned as the first one since it's default?). Thus even though the same piece of code works fine as a standalone application, it just doesn't work on iPlanet app server.
    My work around is:
    Class.forName("my.Driver");
    Enumeration enu = DriverManager.getDrivers();
    Driver useThis = null;
    while (enu.hasMoreElements()) {
    Driver d = (Driver)enu.nextElement();
    if (d.getClass().toString().indexOf("my.Driver") > -1) {
    useThis = d;
    Mind that my above code does not have an performance issue. If you look into the source code of how DriverManager get a Driver for a particular URL, it also loads the whole set of available Drivers, then call acceptsURL() method on each of them to find the first "suitable" one. Thus time complexity is the same.
    I know this is not a very elegant solution and it defeats the purpose of having a DriverManager. Does any one else has a better way to solve this problem, like a way to specify the priority of each Driver so that SQLServerDriver is returned before the netscape Driver?
    Thanks a lot.

  • Problem in connection with sql server

    hi ,
    i am facing problem in connection with ms sql server..please help me out.... i created the database ChandanClient...and there is one table Expense_code_Table...
    i want to insert the data into this table.. i am trying to create a demo example.. here is the code
    package demo;
    import java.sql.*;
    public class getdatabase {
         public static void main(String[] args) {
              Connection con =null;
              int ExpenceCode1=1;
         String ExpenceName1="exp_paper";
         String Organization1="exp_organization";
              try
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433");
                   Statement st = con.createStatement();
                   String q1="INSERT INTO Expense_code_Table(ExpenceCode,ExpenceName,Organization)VALUES("+ExpenceCode1+",'"+ExpenceName1+"','"+Organization1+"')";
         st.execute(q1);
              }catch(Exception e)
                   System.out.println(e);
              try
                   con.close();
              catch (SQLException e)
                   e.printStackTrace();
    after running program
    it is showing me...
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    java.lang.NullPointerException
         at demo.getdatabase.main(getdatabase.java:22)
    Exception in thread "main"
    please help me out how to solve this problem...
    thanks in advance...
    bye
    chandan sharma

    Put ur driver class files in the class path...
    regards
    Shanu

  • Error while connecting to SQL Server

    hello guys ,I am getting a small probs when Itry to connect Sql Server.
    after code is complied, firstly,it can run,but secondly it can't run
    error is:
    Exception in thread "main" java.lang.nullPointerException

    my code is:
    import java.sql.*;
    public class ConnectionBean
    private Connection connection;
    private Statement statement;
    private static final String      
    drive="com.microsoft.jdbc.sqlserver.SQLServerDriver";
    private static final String dbURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=java";
    private static final String login="sa";
    private static final String password="";
    public ConnectionBean()
    try
         Class.forName(drive);
         connection = DriverManager.getConnection(dbURL,login,password);
         statement = connection.createStatement();
    catch (ClassNotFoundException e)
    System.err.println("ConnectionBean: driver unavailable");
    connection = null;
    catch (SQLException e) {}
    public ResultSet executeQuery(String sql) throws SQLException
         return statement.executeQuery(sql);
    protected void finalize()
    try
    connection.close();
    catch (SQLException e) { }
    public static void main(String[] args)
         ConnectionBean bean = new ConnectionBean();
         String sql = "select * from Conferences";
         try
              ResultSet rs= bean.executeQuery(sql);
              while ( rs.next())
                   System.out.println(rs.getString("ID"));
                   System.out.println(rs.getString("city"));
                   System.out.println(rs.getString("airport"));
                   System.out.println(rs.getString("seats"));
         catch (SQLException e)
         finally
         bean.finalize();     
    }

  • Getting Frequent time out while Connecting to SQL server 2008 Instance installed on VmWare

    Hi,
    I have a production SQL server Database with default instance. when I connect this instance from 10 attempts it get connected only 5-6 times. I connect this through SSMS. Some of jobs also getting failed due to login time out expired. please help in this.
    Product is SQL server 2008 Enterprise Edition
    Thank You
    Yogesh Arora

    Yogesh Arora
    Have you checked Event Viewer and ERROR.LOG?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Getting problem when connecting to SMTP server through java code

    Hi all,
    I am getting problem when i am going to connect with "Kerio SMTP server" through java code. The error what i am getting is :
    "[16/Sep/2008 15:59:09] Sent: Queue-ID: 48cf8a73-000000f9, Recipient: <[email protected]>, Result: failed, Status: 5.3.2 554 5.0.0 Too many hops (101, max 100), message looping" when sending an email from [email protected]

    Looks like something is set up wrong on your server that's causing messages
    to be forwarded around a loop too many times without ever reaching the destination.
    For instance, if server A forwards to server B, and server B forwards to server A,
    this would happen.

  • E6 Problem while connecting to OVI Server

    I am not able to connect with OVI server. I can use internet on mobile as well as laptop. So there is no problem with the internet connection. 
    Need help as i want to update my mobile software which can only be done after signing in into OVI server...
    Plz help.......
    Attachments:
    Could not connect to server.jpg ‏113 KB

    Wish could help.
    Still on E72 but reading this all here @ support sicussions I think I am glad NOT having bought E6 yesterday...

  • Error while connecting to SQL Server 2000 using Heteregenous Services 11g

    Hope this is the right thread to post on! We have been given the challenge of connecting to and reading data from a SQL Server 2000 database.
    Our Infrastructure guys have set up the network access.
    The SQL Server DB is set to windows NT Authentication only (N.B. NOT Mixed Mode) as there is an application running against the DB locally that will not run under Mixed Mode.
    Our Oracle partner has download and installed the 11g Heteregenous Services. all works fine until the point we try to create the DBLink and then connect to the SQL Server DB when we get:
    SQL> CREATE DATABASE LINK infoteam1.sco.infoteam.co.uk CONNECT TO "sco.infoteam.co.uk/infoteam" IDENTIFIED BY "########" USING 'dg4msql';
    Database link created.
    SQL> select * from "systables"@infoteam1.sco.infoteam.co.uk;
    select * from "systables"@infoteam1.sco.infoteam.co.uk
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC SQL Server Driver][SQL Server]Login failed for user
    'sco.infoteam.co.uk/infoteam'. Reason: Not associated with a trusted SQL Server
    connection.[Oracle][ODBC SQL Server Driver]Invalid connection string attribute
    ORA-02063: preceding 2 lines from INFOTEAM1.SCO.INFOTEAM.CO.UK
    The question is can we (and if so how)?) connect to the SQL Server using an NT Windows Authorised account?
    Jeremy

    Hi,
    Please look at MOS note
    ORA-28500: Generic connectivity using ODBC DSN over mapped drive fails [ID 105210.1]
    Ora-28500 with Ms Sqlserver - Not associated with a trusted SQL Server connection [ID 333775.1]
    Regards,
    Edited by: gjilevski1 on Aug 31, 2010 8:23 AM

  • Error while connecting to external server through SOAP/HTTP adapter

    Hi,
    we are trying to connect to the external server through SOAP adapter. The scenario is proxy to SOAP asynchronous scenario.
    We are getting following error in Communication channel monitoring:
    *Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error Application/UNKNOWN/APPLICATION_ERROR - application fault*
    We also tried HTTP adapter in the receiver side. But it is giving red flag in SXMB_MONI with following error:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_SERVER</SAP:Code>
      <SAP:P1>500</SAP:P1>
      <SAP:P2>Internal Server Error</SAP:P2>
      <SAP:P3>Internal Server Error</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>HTTP server code 500 reason Internal Server Error explanation Internal Server Error</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please help.
    Thanks in advance.
    Regards,
    sriparna

    Make sure that the receiver webservice is up and running and in a state to receive the external calls. Confirm if the data you send is as per the requirement of the webservice and they haven't changed anything at their end.
    Regards,
    Prateek

Maybe you are looking for

  • How to find the number of Z or Y programs and amount of code lines?

    hi all, I'm trying to find the number of programs on user namespace (Z* or Y*) and the number of coded lines in them. something like report Z_MY_REPORT, lines 582; Include Z_MY_INCLUDE, lines 135. Exist any standard report to do it or do I have to de

  • Import DV AVI Files with 5.1 Audio

    To my surprise, Encore would not import DV AVI files from Premiere with 5.1 Audio. I much prefer to do my transcoding in Encore rather than in Premiere so I don't have to guess how much disk space will remain after menus and other content. Also, I th

  • Exiting a do while loop

    i want to repeatedly ask the user to enter information until they dont enter any data and press enter. so the while condition has to be while they dont press enter. how do i make this the condition with coding? thanks, Peter

  • Is an 27-inch: 3.1GHz iMac good for minor gaming?

    Hello! I was wondering if the 3.1GHz iMac is good for minor gaming. By minor, I am not talking CoD or Wow. Rather, I am talking about games like Hearts of Iron 3 and Crusader Kings 2 (large games but less complex I feel, maybe I am wrong). My black M

  • GUI Client

    Does the instant client for linux have this GUI based SQL*Plus? like the one with windows?