MS JDB driver and temp tables scope

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Roman (Roman_at_discussions.microsoft.com)
Date: 07/17/04


Date: Fri, 16 Jul 2004 18:41:01 -0700

I have a problem with the driver when creating a temp table and keepping it available for the session.
    try {
        Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    } catch (ClassNotFoundException e) {
        System.out.println("Exception caught: " + e.getMessage());
    }
    try {
        java.sql.Connection conn =
            java.sql.DriverManager.getConnection(
                "jdbc:microsoft:sqlserver://SERVERNAME:1433;selectMethod=cursor;DatabaseName=DBNAME",
                "dbxx",
                "dbxx00");

        java.sql.Statement stmt1 = conn.createStatement();
        stmt1.executeUpdate("select * into #ctr from dbxx.ctr_master where 0 = 1");

        int ret = -1;
        java.sql.Statement stmt2 = conn.createStatement();
        java.sql.ResultSet rs = stmt2.executeQuery("select spid from #ctr");
        if (rs == null)
            System.out.println("Ctr is Empty");
        rs.next();
        ret = rs.getInt(1);

        conn.close();
    } catch (java.sql.SQLException s) {
        System.out.println("Exception caught: " + s.getMessage());
    }
  
When I execute second statemet, I am getting an error:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name '#ctr'.

This works with other JDBC drivers. Why? Is it beacause of the connecton pooling support? Any suggestions.

Thanks



Relevant Pages

  • RE: Terminal server Fax driver...
    ... I wonder if your print driver is being run as admin (not ... It is a fax driver that installs just like a ... The browser page opens on the TS main console, and not in the session. ...
    (microsoft.public.windows.terminal_services)
  • RE: Terminal server Fax driver...
    ... MCSE, CCEA, Microsoft MVP - Terminal Server ... Since its just like a printer driver, I can't see that it would ... I'll check out the "session 0" thing. ... Install mode issue maybe? ...
    (microsoft.public.windows.terminal_services)
  • Re: wince serial driver
    ... serial driver by using Windows CE 5.0 XSCALE CSP driver. ... > data bits, no parity, 1 stop bit, no flow control. ... > soon as you have your terminal session set to odd parity and the session ... > the ARM based device set to no parity you will loose characters. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Display Device Mirror Driver - Build or Buy?
    ... mirror drivers receive DDI calls in a multicast ... > have access to the display regardless of the current session? ... > sessions since the mirror display driver gets "instanced" in to each new ...
    (microsoft.public.development.device.drivers)
  • Re: Connect to access
    ... one where do i get it and how to installs it. ... using the Sun JDBC/ODBC Driver. ... ClassNotFoundException while trying to load the driver. ...
    (comp.lang.java.programmer)