SQLJ connection to SQLServer

Hello,
Is it possible using SQLJ to connect to sqlserver? When I try, I am getting error:
java.lang.IllegalArgumentException: SQLJ programs translated with the option -codegen=oracle must be run under Oracle JDBC 9.0.0 or higher. If the Oracle JDBC driver is wrapped, then the wrapper must implement all of the oracle.jdbc.OracleXxxx interfaces. Alternatively, you can translate SQLJ programs either with -codegen=iso or with -codegen=jdbc.
Code
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
          Oracle.connect("jdbc:microsoft:sqlserver://10.10.10.10:1433;DatabaseName=zzz;User=123;Password=1234",true);
#sql iterator SeatCursor1(Timestamp CLOSE_DATE, String TERMINAL_PRODUCT_NUMBER,String NAME,String TANK_CODE,int OPENING_PHYSICAL_GROSS_QTY,int CLOSING_PHYSICAL_GROSS_QTY);
SeatCursor1 sc;
#sql sc = { select  CLOSE_DATE ,TERMINAL_PRODUCT_NUMBER,NAME,TANK_CODE,OPENING_PHYSICAL_GROSS_QTY,CLOSING_PHYSICAL_GROSS_QTY from cbv by CLOSE_DATE desc};

Cosmos,
I don't use SQLJ, but it's just a sort of "shorthand" for JDBC code, so pardon me if this is a silly suggestion, but why don't you just write pure JDBC code -- without using SQLJ?
[Note that below code is uncompiled and untested.]
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url = "jdbc:microsoft:sqlserver://10.10.10.10:1433/zzz";
String user = "123";
String password = "1234";
Connection c =  = DriverManager.getConnection(url, user, password);
Statement s = c.createStatement();
String sqlQuery = "select ...";
ResultSet rs = s.executeQuery(sqlQuery);
while (rs.next()) {
  // Process the result set
}If you haven't already done so, I suggest looking at the JDBC Database Access trail in the Java Tutorial:
http://java.sun.com/docs/books/tutorial/jdbc/index.html
Good Luck,
Avi.

Similar Messages

  • Oracle client connecting to sqlserver

    oracle client connecting to sqlserver in local machine. working fine.
    but I am connecting to remote sqlserver getting error
    obojects does not exist
    listenter not started.
    No firewall, port is open, entry in the sqlnet.ora, tnsnames.ora, listener.ora
    all correct.
    I have qusetion, connecting oracle client and sqlserver
    we need install any special odbc
    please let me know

    this question should be in HS forum
    and oracle client (eg sqlplus) can't directly connect to other ODBC databases., but oracle server can through heterogeneous connectivity (HS) and yes server will need ODBC driver to do that.
    http://www.oracle-doku.de/oracle_10g_documentation/server.101/b10764/toc.htm
    Eugene Roytman

  • SQLJ Connection Context

    Hi,
    i was trying to create a SQLJ connection context following the procedure given in the following link.
    https://help.sap.com/saphelp_nw04/helpdata/en/70/a19cc472e72c4481172909938578fc/frameset.htm
    But i am getting  error when i am inserting this sqlj statement inside the class Ctx
    public class Ctx
         #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");//here i am getting this error
    Error               
    SQLJ: The ConnectionContext class "Ctx" must not be declared as an inner class of the class "temp.persistence.gettingstarted.dao.Ctx". It may be declared as a static inner class.     Ctx.sqlj     OpenSQLWeb/source/temp/persistence/gettingstarted/dao     
    could u tell me how i can resolve this.

    Hi,
      i think you are refering to the sqlj file
      with reference to the example its ctx.sqlj
      The contents of the file are
    <-- Start -->
    package temp.persistence.gettingstarted.dao;
    #sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE");
    <-- End -->
    its not a class file.
    If you have installed JDT, you will have the complete working example in 'C:\Program Files\SAP\JDT\eclipse\examples\J2EE_GettingStartedOpenSQL.zip'
    Hope that helps.
    Regards,
    S.Divakar

  • Connection to sqlserver

    what folder does the jar file for the sqlserver jdbc drivers go? The documentation says [JRE_HOME]/lib, but the Oracle drivers are in oc4j\jdbc\lib folder.

    Hi JD;
    I didn't install SQLServer 2000/2005 BUT what I installed in my laptop was small version of SQLServer called "SQLServer Express" same as Oracle XE.
    This is what I did to accomplish the task on SQLServer Express:
    1) Downloaded latest version of SQLServer JDBC driver from Microsoft website
    2) Set up login connection to SQLServer using "SQLServer Authenication" NOT windows.
    3) Create AdventureWorks or Nortwind schema downloaded from Microsoft website.
    4) Create a user thru SQLServer Management Studio is like ORACLE DB console.
    5) test the connection from SQLServer
    6) test the connextion using XMLP JDBC connection
    Also to make more spicier I did the connection to MS-ACCESS using ODBC:JDBC driver BUT the Query Builder didn't work but my small sqlscript worked for a demo to clients.
    Here are the link to achieve:
    http://download.microsoft.com/download/d/8/6/d865cf0c-c44b-401b-b426-b3bf5c628112/SQLServerDatabasesAndSamplesOverview.htm
    http://www.oracle.com/technology/products/jdev/howtos/bc4j/bc_psqlserverwalkthrough.html
    HTH
    Shaun S

  • Hang process mamping connect to sqlserver 2000

    Help me
    Problem this, before one weeks , process mapping connect to sqlserver still running
    but, after this process mapping hang get data from sqlserver 2000
    because i try 10, 100, 5000 record mapping still running, but 100000 record still hang, this is i try method row_bases.
    and i try method set based, data still empty in target (4 hours)
    this data from sqlserver +/- 1600000 record,
    how to solve problem this.
    owb client 11.1.0.6.0
    owb repository 11.1.0.1.1
    db ver 11.1.0.6
    db sqlserver 2000
    OS Window NT 2000
    Tx

    do you mean the url?
    it seems to be right.
    the server is on THE_B
    the instance is MIAINSTANCE
    (when i've installed the DBMS i've specified "miaInstance" as instance name,but whe I access to it I see MIAINSTANCE as name.it can be a case sensitive problem?)
    i've specified the following URL
    ...sqlserver://THE_B\MIAINSTANCE:1433;SelectMethod=....
    i've also tryed
    ...sqlserver://THE_B\miaInstance:1433;SelectMethod=....
    but it still doesen't work.
    yes,the instance is running.

  • SQLJ connection exception in oracle 8i and jdk 1.5

    This is the code through which i am trying to extract current date from oracle database and print Helloworld
    // import required packages
    import java.sql.Date;
    import java.sql.SQLException;
    import oracle.sqlj.runtime.Oracle;
    public class HelloWorld {
    public static void main(String [] args) {
    java.sql.Date current_date;
    try {
    // connect to the database
    Oracle.connect(
    "jdbc:oracle:thin:@localhost:1521:orcl",
    "student",
    "student"
    // get the current date from the database
    #sql { SELECT sysdate INTO :current_date FROM dual };
    // display message
    System.out.println("Hello World! The current date is " +
    current_date);
    } catch ( SQLException e ) {
    System.err.println("SQLException " + e);
    } finally {
    try {
    // disconnect from the database
    Oracle.close();
    } catch ( SQLException e ) {
    System.err.println("SQLException " + e);
    } // end of main()
    this is the error
    unexpected error occurred...
    java.lang.ExceptionInInitializerError
         at sqlj.translator.Translator.addUnit(Translator.java:117)
         at sqlj.translator.Main.translate(Main.java:112)
         at sqlj.translator.Main.runTranslation(Main.java:92)
         at sqlj.translator.Main.runTranslation(Main.java:85)
         at sqlj.tools.Sqlj.statusMain(Sqlj.java:280)
         at sqlj.tools.Sqlj.main(Sqlj.java:125)
    Caused by: java.lang.NullPointerException
         at sqlj.framework.ClassFileReader.attribute_info(ClassFileReader.java:326)
         at sqlj.framework.ClassFileReader.readClass(ClassFileReader.java:224)
         at sqlj.framework.ClassFileReader.describeClass(ClassFileReader.java:62)
         at sqlj.framework.ClassFileReader.getDeclaringClass(ClassFileReader.java:146)
         at sqlj.framework.JSClass$ClassWrapper.getDeclaringClass(JSClass.java:1649)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1496)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1545)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1552)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1507)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1533)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1495)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1518)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1494)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1534)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1539)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1508)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.resolveIfNonNull(JSClass.java:1513)
         at sqlj.framework.JSClass.resolveClassReferences(JSClass.java:1493)
         at sqlj.framework.JSClass.reflectSystemClass(JSClass.java:1340)
         at sqlj.framework.JSClass.<clinit>(JSClass.java:49)
         ... 6 more
    HelloWorld.sqlj: Error: Exception caught:
    Total 1 error.

    SQLJ 8i with jdk1.5?
    Please try SQLJ 10.2 with jdk1.4.

  • Error when connect to sqlserver

    I encounter the following error,any 1 can tell me reason?
    com.solarmetric.kodo.runtime.FatalDataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer JDBC Driver]Error establishing socket.
    [code=0;state=08001]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing
    socket.
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Connection timed
    out: connect
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLException
    s.java:58)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:212)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    ..java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing
    socket.
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.createConnection(Data
    SourceImpl.java:932)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.findConnection(DataSo
    urceImpl.java:844)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.getConnection(DataSou
    rceImpl.java:563)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    321)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    314)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.DataSourceConnector.getConnection(Dat
    aSourceConnector.java:63)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:179)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    ..java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Connection timed
    out: connect
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.createConnection(Data
    SourceImpl.java:932)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.findConnection(DataSo
    urceImpl.java:844)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.getConnection(DataSou
    rceImpl.java:563)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    321)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    314)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.DataSourceConnector.getConnection(Dat
    aSourceConnector.java:63)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:179)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    ..java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    com.solarmetric.kodo.runtime.UserException: This operation cannot be
    performed while a Transaction is active.
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:1058)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:1042)
    at com.ipacs.als.test.Test.main(Test.java:183)
    Exception in thread "main" Process terminated with exit code 1
    Regards,
    geduo

    Geduo-
    It sounds like your ConnectionURL is not correct. Can you post the
    properties you are trying to use?
    In article <[email protected]>, geduo wrote:
    I encounter the following error,any 1 can tell me reason?
    com.solarmetric.kodo.runtime.FatalDataStoreException: java.sql.SQLException:
    [Microsoft][SQLServer JDBC Driver]Error establishing socket.
    [code=0;state=08001]
    NestedThrowables:
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing
    socket.
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Connection timed
    out: connect
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLException
    s.java:58)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:212)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    .java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    NestedThrowablesStackTrace:
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Error establishing
    socket.
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.createConnection(Data
    SourceImpl.java:932)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.findConnection(DataSo
    urceImpl.java:844)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.getConnection(DataSou
    rceImpl.java:563)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    321)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    314)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.DataSourceConnector.getConnection(Dat
    aSourceConnector.java:63)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:179)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    .java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Connection timed
    out: connect
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
    Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.createConnection(Data
    SourceImpl.java:932)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.findConnection(DataSo
    urceImpl.java:844)
    at
    com.solarmetric.datasource.DataSourceImpl$AbstractPool.getConnection(DataSou
    rceImpl.java:563)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    321)
    at
    com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:
    314)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.DataSourceConnector.getConnection(Dat
    aSourceConnector.java:63)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBDictionaryFactory.getDictionary(DBDi
    ctionaryFactory.java:179)
    at
    com.solarmetric.kodo.impl.jdbc.JDBCSimpleConfiguration.getDictionary(JDBCSim
    pleConfiguration.java:377)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDictionary(JDBCSt
    oreManager.java:710)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.getExpressionFactory(JDBCQuer
    y.java:112)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.<init>(QueryImpl
    .java:1516)
    at
    com.solarmetric.kodo.query.QueryImpl$QueryExecutionManager.getQueryExecutor(
    QueryImpl.java:1351)
    at com.solarmetric.kodo.query.QueryImpl.internalCompile(QueryImpl.java:462)
    at
    com.solarmetric.kodo.query.QueryImpl.getAccessPathClasses(QueryImpl.java:116
    1)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:574)
    at com.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:533)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:483)
    at com.ipacs.als.test.Test.main(Test.java:125)
    com.solarmetric.kodo.runtime.UserException: This operation cannot be
    performed while a Transaction is active.
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:1058)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:1042)
    at com.ipacs.als.test.Test.main(Test.java:183)
    Exception in thread "main" Process terminated with exit code 1
    Regards,
    geduo
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Connecting to SQLserver 2005 via Web Analysis using a JDBC driver

    We are currently working on a web analysis suite and have been trying to create a SQL spreadsheet data object.
    After downloading and supposedly installing the sqljdbc.jar driver, we are having problems getting a connection to MS SQL server 2005.
    We set the classpath to this driver in the operating system (Windows server 2003) but are unsure exactly how to set this classpath in Tomcat 5.0.28 as recommended by the help file. We have tried editing the catalina.bat and catalina.50.bat in the \Hyperion\common\appServers\Tomcat\5.0.28\bin folder to point to sqljdbc.jar, but to no avail.
    So....does anyone have any experience on setting up the JDBC driver for MSSQLServer 2005 and making a connection in Web Analysis. Could you please give a step by step account of how this is done?

    Hi,
    In the past I have used two methods either updating the registry for the web application or by placing the jar file in the following directory
    \Hyperion\deployments\Tomcat5\WebAnalysis\webapps\WebAnalysis\WEB-INF\lib
    If you do place it in that directory you will need to restart the web analysis web server.
    Then in web analysis studio go to file > new > database connection >Relational
    Select Microsoft SQL Server
    JDBC Driver
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection string
    jdbc:microsoft:sqlserver://<servername>:1433;DatabaseName=<dbname>;SelectMethod=cursor
    Enter username/password
    There is always the Merant SQL server connection that can be used as well.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Unable to establish connection with SQLServer from Java Application

    Dear All,
    I am facing the issue of establishing connection with SQL Server from Java project developed in NWDS. I am writing a jaas plug-in, as a part of that I am writing a login module to authenticate a web application through jaas, and I got need of fetching some data from SQL Server which is located in remote host. I am getting error in the line of code
    <b>Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")</b>
    I also added the 3 jar files (msbase.jar,mssqlserver.jar,and msutil.jar) to my login module project and copied the same files at C:\usr\sap\J2E\JC01\j2ee\cluster\server0\bin\ext\MSSQL.
    My MI Landscape is j2ee stack + abap stack +WAS 6.40 with MAXDb as a database.
    Could anyone please let me know the solution if you are aware of it.
    Thanks and Regards,
    Kishore

    I solved it by writing the following code
    Connection con;
    Statement stmt;
    DataSource ds;
    Context ctx;
    ctx = new InitialContext();
    if(ctx == null)     throw new Exception("Boom - No Context");
    ds=(DataSource)ctx.lookup("jdbc/SQLDB");     
    con = ds.getConnection();
    stmt = con.createStatement();
    String query = "SELECT * FROM SubjectBIR where Subject_ID='" + user + "'";
    ResultSet result  = stmt.executeQuery(query);
    stmt.close();
    con.close();

  • Connecting to sqlserver using named pipe

    I would like to connect to mssql (running on same PC as SQL Developer) using named pipes.
    The host is listed in the Windows Service Manager as \\SX3102971\SIMSLOCAL
    I have gone to the 'Oracle' tab, selected 'Advanced' and in the 'Custom JDBC URL'
    entered
    jdbc:jtds:sqlserver:\\SX3102971\SIMSLOCAL;namedPipe=true;user=<username>;password=<password>
    where <username> and <password> are the true values.
    I receive a message
    Staus : Failure -Invalid connection information specified. Verify the URL format for the specified driver.
    Can anyone advise on what may be wrong?
    Also, can SQLDeveloper handle blank passwords?
    The database is installed as part of a third party application, which sets the default dba logon with no password. SQL Developer states that a password is required. For the example above I have created my own log on.

    Hi,
    I managed to solve the problem. So don't worry about it.
    For others who are looking for the solution...
    - I have referred to the http://www.qint.de/joria/doc/jdbc/jtds.html.
    - I have changed the URL element in IDEConnections.xml file located under where SQLDEVELOPER software is installed.
    - The URL must look like the following ...
    <URL>jdbc:jtds:sqlserver://\\.\;namedPipe=true;instance=<name of the database - without the server name>;</URL>
    Hope this helps.
    Regards
    Raja
    Message was edited by:
    rajaram_r

  • -How to use JDBC to connect the SQLServer and Oracle.

    Hi,
    I create a table in the WIP DB, I want to modify this table when use "PRE-START" activity in POD.
    SAPME version: 5.2.3.4     SDK:2.0    DB:SQL2005 and Oracle 10.2g
    SourceCode like below:
    public void execute(StartHookDTO dto) throws Exception {
              initServices();
              try{
                   Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                   Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=SAPMEWIP", "sa" ,"sap12345");
                   conn.close();
              }catch(Exception e){
                   e.printStackTrace();
    Besides, I already setup the JDBC ClassPath in ConfigTool, but it gets somes error when executing.
    the error code like below:
    java.sql.SQLException: No suitable driver
    Please give me some support or a example, thank you so much!
    Br,
    Alex

    You probably want to use the WIP Datasource defined in JNDI.

  • Connecting to SQLServer 2k named Instance

    Hey guys, this time i need some URGENT help, i swapped from windows to linux platform and using CF9, when i create a DSN in windows using SERVER_NAME\INSTANCE_NAME for the Server field, filling user name and password with a Microsoft SQL Server native DSN works perfectly, but when i do this same thing on Linux i get this nasty error:
    java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC  Driver]The requested instance is either invalid or not running.
    The root cause was that:  java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC  Driver]The requested instance is either invalid or not running.
    So i tryed to create a connection using the "Other" as DSN type and filled out this info:
    CF Data Source Name: Test
    JDBC URL: jdbc:sqlserver://SERVER_NAME\INSTANCE_NAME:1433;DatabaseName=MyDatabase
    Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    Driver Name: SQL Server JDBC
    User name: myuser
    Password: mypass
    i get this error:
    Connection verification failed for data source: test
    com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP  connection to the host FULLSQL, port 1433 has failed. Error: "Connection  refused. Verify the connection properties, check that an instance of  SQL Server is running on the host and accepting TCP/IP connections at  the port, and that no firewall is blocking TCP connections to the  port.".
    This was done after downloading sqljdbc_3.0.1301.101_enu.tar.gz from microsoft's web site and placing the sqljdbc4.jar file inside the /opt/coldfusion9/runtime/lib directory.
    So basically the first way to create the connection works on windows but not on linux, and the second way does not work in any place even tho it's supposed to be working...
    Please send me some help ASAP, need this thing working BADLY!

    Okay, just solved the mistery... i will NEVER connect since every time you install a new SQL Server instance THAT new instance will listen to a different port, in this case the default 1433 was working but for the first instance and i was trying to connect to a second one listening in some other port i can't remember ATM.
    Thanx for that help ne way Adam....!

  • DB_Connect Error connecting to SqlServer

    We have a BI Netweaver 7.0 system running on Itanium with an Oracle Database.
    Using tcode RSA1 I wanted to create a remote connect to a SqlServer database.
    The DBMS type is MSS. The error message we are getting is "No shared library found for the database"
    Is this possible?

    SQL server must be possible using dbconnect, a checklist for you to review in case you missed out on something:-
    1. Check:-
    If the source DBMS and BI DBMS are different - {your case (Oracle and sql server) }:
    &#9675;       You have installed the database-specific DB client software on your BI application server. You can get information about the database-specific DB client from the respective database manufacturers.
    &#9675;       You have installed the database-specific DBSL on your BI application server.
    2. Procedure for Installing DBSL: [http://help.sap.com/saphelp_nw70/helpdata/EN/50/63d6b37bda7f4a92e2dec21b14ceee/frameset.htm]
    3. List and specifications (supported databases)
    [http://help.sap.com/saphelp_nw70/helpdata/EN/50/63d6b37bda7f4a92e2dec21b14ceee/frameset.htm]
    This links hints at some pre-requisites for the connection, check if you satisfy all.
    Hope this helps.
    Cheers,
    Sumit

  • Unable connect to SQLServer

    I using JDBC driver (Microsoft SQL Server 2000 Driver for
    JDBC) to access Database (SQLServer 2000).
    I using NonXA-Datasource
    driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
    INDI name : jdbc/SqlServer
    url : jdbc.microsoft.sqlserver://local:1433;user=testuser;password=testpass;databasename=TestDB
    reference name: jdbc/TestDB
    I had set J2EE_CLASSPATH to classpath of jar file (msbase.jar,mssqlserver.jar,msutil.jar)
    function makeconnection :
    private void makeConnection() throws NamingException, SQLException {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection("testuser","testpass");
    with dbname
    private String dbName = "java:comp/env/jdbc/TestDB";
    But when I run application, I receive exception 'unable to connect to database'
    Can you help me? Thanhs.
    Leb.

    What is your JNDI provider? Is it Weblogic? Or some LDAP scheme?
    The reason I ask is that you specify
    DataSource ds = (DataSource) ic.lookup(dbName);which means that should already have loaded a 'pool' ( even if you just specified one )? So some application server is managing a 'pool' of DataSources for you. Which also means that if you arent getting a connection with
    ds.getConnection();The pool is never being built properly.
    Now it is my understanding that you should typically provide your pool with username and password so it can actually load the pool ( test connections even ) when the app server starts or the context loads. If you don't, then you arent getting connected, and the pool return empty DataSource objects which you'll try to connect to afterward as you are doing unsuccessfully.
    So by this rationale, there is a problem in your configuration of the datasource itself. Check that in fact the class is in your classpath and being loaded, and that the datasource configuration is valid.
    If you can though, please be more specific about the situation ( app server etc ).
    L
    I using JDBC driver (Microsoft SQL Server 2000 Driver
    for
    JDBC) to access Database (SQLServer 2000).
    I using NonXA-Datasource
    driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
    INDI name : jdbc/SqlServer
    url :
    jdbc.microsoft.sqlserver://local:1433;user=testuser;pas
    word=testpass;databasename=TestDB
    reference name: jdbc/TestDB
    I had set J2EE_CLASSPATH to classpath of jar file
    (msbase.jar,mssqlserver.jar,msutil.jar)
    function makeconnection :
    private void makeConnection() throws
    s NamingException, SQLException {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup(dbName);
    con = ds.getConnection("testuser","testpass");
    with dbname
    private String dbName = "java:comp/env/jdbc/TestDB";
    But when I run application, I receive exception
    'unable to connect to database'
    Can you help me? Thanhs.
    Leb.

  • Java Connection to SqlServer using SQLServerDatasource

    Please HELP,
    I have this
    import javax.sql.DataSource;
    import java.io.IOException;
    import java.sql.Connection;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.sql.SQLException;
    import javax.naming.*;
    import java.rmi.RemoteException;
    import java.rmi.Remote;
    import com.microsoft.sqlserver.jdbc.*;
    public class AvocatData
          private SQLServerConnectionPoolDataSource dataSource;
         private Connection conn;
         public AvocatData()
         public void init() throws SQLException
         try{
                    Context lContext = new InitialContext();
                   dataSource=(SQLServerConnectionPoolDataSource)lContext.                                                       lookup("java:comp/env/jdbc/vladHotel");
                  conn=dataSource.getConnection();
               }catch(Exception ex){ex.printStackTrace();
    }and give this error:
    javax.naming.NoInitialContextException:Need to specify class name in enviroment or system property,or as an applet paramater,or in an application resource file:java.naming.factory.initial

    Gateway for ODBC 10g or 11g is only supported with SQL Server Authentication, not Windows authentication.
    If your SQL Server is only configured for Windows authentication, you have no other way to change the configuration of the SQL Server to support the Mixed Mode (both Windows authentication and SQL Server authentication).
    Regards,
    --Mireille                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for