DSNless connection

I guess this isn't related to jdbc-area but here. What Im looking for is method telling directory where currently running application is located. I have a static string
static String conString="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};SERVER=myserver;DBQ=c:\\apps\\myDb.mdb";and that path is now hardcoded but it shouldn't be. So something like this is needed (I guess):
String myLocation = tellMyLocation();
static String conString="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};SERVER=myserver;DBQ="+myLocation+"\\myDb.mdb";

easy : use a file giving the location and read this file to get the location !! The location of this file will be hardcoded !!
Good luck

Similar Messages

  • ODBC DSNless connection

    I created some ASP pages for a database and while onmy local
    machine everything was good.
    When uploaded to my host the connection failed and they
    suggested a DSNless connection, i reasearched it on the net and
    there were several tutorials but none of them worked.
    The current connection is
    // FileName="Connection_odbc_conn_dsn.htm"
    // Type="ADO"
    // DesigntimeType="ADO"
    // HTTP="false"
    // Catalog=""
    // Schema=""
    var MM_tracks_STRING = "dsn=tracks;"
    and the link on the ASP pages is
    <%@LANGUAGE="JAVASCRIPT"%>
    <!--#include file="Connections/tracks.asp" -->
    <%
    var rstracks_cmd = Server.CreateObject ("ADODB.Command");
    rstracks_cmd.ActiveConnection = MM_tracks_STRING;
    rstracks_cmd.CommandText = "SELECT * FROM tracks ORDER BY
    Suburb ASC";
    rstracks_cmd.Prepared = true;
    var rstracks = rstracks_cmd.Execute();
    var rstracks_numRows = 0;
    %>
    Can anyone help me modify this to get it working?

    replace this:
    <!--#include file="Connections/tracks.asp" -->
    With this:
    <%
    Dim MM_tracks_STRING
    MM_tracks_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=C:\SomeFolder\SomeDatabase.mdb;"
    %>
    Be sure to keep the MM_tracks_STRING = line on one line
    Ken Ford
    Adobe Community Expert
    Fordwebs, LLC
    http://www.fordwebs.com
    "XaeroRamirez" <[email protected]> wrote in
    message news:eto73e$29c$[email protected]..
    >I created some ASP pages for a database and while onmy
    local machine everything
    > was good.
    > When uploaded to my host the connection failed and they
    suggested a DSNless
    > connection, i reasearched it on the net and there were
    several tutorials but
    > none of them worked.
    > The current connection is
    > // FileName="Connection_odbc_conn_dsn.htm"
    > // Type="ADO"
    > // DesigntimeType="ADO"
    > // HTTP="false"
    > // Catalog=""
    > // Schema=""
    > var MM_tracks_STRING = "dsn=tracks;"
    >
    > and the link on the ASP pages is
    > <%@LANGUAGE="JAVASCRIPT"%>
    > <!--#include file="Connections/tracks.asp" -->
    > <%
    > var rstracks_cmd = Server.CreateObject
    ("ADODB.Command");
    > rstracks_cmd.ActiveConnection = MM_tracks_STRING;
    > rstracks_cmd.CommandText = "SELECT * FROM tracks ORDER
    BY Suburb ASC";
    > rstracks_cmd.Prepared = true;
    >
    > var rstracks = rstracks_cmd.Execute();
    > var rstracks_numRows = 0;
    > %>
    >
    > Can anyone help me modify this to get it working?
    >

  • Dreamweaver & DSNless connection

    Dreamweaver & DSNless connection
    I am fairly familiar with Dreamweaver and creating static web
    pages. However this is my first attempt at a dynamic webpage and I
    have hit several hurdles.
    First I setup a DSN connection...but was later told by my
    host that a DSNless connection would work better. So that is what I
    am not working on.
    They told me to use the following script
    Set oConn=Server.CreateObject("ADODB.Connection")
    filePath = Server.MapPath("Your Access DB File")
    oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    +filePath)
    So I did that I entered this script into the Database/Custom
    Connection String/Connection string in Dreamweaver CS3
    Set oConn=Server.CreateObject("ADODB.Connection"); filePath =
    Server.MapPath("echohockeydb.mdb");
    oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    +\echohockey\Database)
    When I click "Test" I get the following error
    Unknown error 0x800A0BB9
    Arguements are of the wrong type, are out of acceptable
    range, or are in conflict with one another.
    Since I am just learning, I don't know if I entered the
    information in the script wrong, or if my problem lies elsewhere.
    The really frustrating part is that my page is uploaded and it
    works, but I need to change the data that is on the page. When I go
    back to add/edit the record sets it tells me that it cannot find
    the record set or the database connection.
    Is the problem obvious? Do you need mor info to troubleshoot?
    Sorry for this question, I am teetering on the edge of being out of
    my league with this project.
    THANKS!

    "Dante2004" <[email protected]> wrote in
    message
    news:[email protected]...
    > Still working on this...
    >
    > Learning more as I go...I have two connection files for
    the DSNless
    > connection
    >
    > connECHOHockey.asp
    > <%
    > Set oConn=Server.CreateObject("ADODB.Connection")
    > filePath = Server.MapPath("Database\echohockeydb.mdb")
    > oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=" +filePath)
    > %>
    >
    > And connECHOHockey2.asp
    > <%
    > ' FileName="Connection_ado_conn_string.htm"
    > ' Type="ADO"
    > ' DesigntimeType="ADO"
    > ' HTTP="true"
    > ' Catalog=""
    > ' Schema=""
    > Dim MM_connECHOHockey2
    > MM_connECHOHockey2_STRING = Driver={Microsoft Access
    Driver (*.mdb)}
    > Dbq=C:\Inetpub\wwwroot\echohockey\Database\echohoc
    keydb.mdb;
    > %>
    >
    > I figured out why the pages that work, are working. They
    are referencing
    > connECHOHockey.asp The problem is, that when I goto
    Application|Databases
    > in
    > DW, it only lists connECHOHockey2.asp When I go into the
    > connECHOHockey2.asp
    > database to add bindings, it says that it is unable to
    select tables with
    > this
    > connection. If I goto databases and test the connection
    I get this
    > error...
    >
    > "Format of the initialization string does not conform to
    the OLE DB
    > specification".
    >
    > I haven't gotten this error before. Not sure if this is
    progress or not.
    Unless the forum mangled your code (doesn't seem like it
    because
    connECHOHockey looks okay)
    You are missing quotes in the MM_connECHOHockey2_STRING
    connectionstring
    MM_connECHOHockey2_STRING = "Driver={Microsoft Access Driver
    (*.mdb)};Dbq=C:\Inetpub\wwwroot\echohockey\Database\echohoc
    keydb.mdb;"
    The problem with MapPath in a dreamweaver connectionstring is
    that
    dreamweaver doesn't execute that function, you can try fixing
    this by
    defining the connectionstring twice, first with the full path
    of the
    database on your local machine (this is what dreamweaver will
    use), and
    second with the mappath, it'll override the connectionstring
    when the page
    is executed by the server, but not by Dreamweaver because it
    only looks for
    the first string.
    <%
    ' FileName="Connection_ado_conn_string.htm"
    ' Type="ADO"
    ' DesigntimeType="ADO"
    ' HTTP="true"
    ' Catalog=""
    ' Schema=""
    Dim MM_connECHOHockey2
    MM_connECHOHockey2_STRING = "Driver={Microsoft Access Driver
    (*.mdb)};Dbq=C:\Inetpub\wwwroot\echohockey\Database\echohockeydb.mdb;"
    MM_connECHOHockey2_STRING = "Driver={Microsoft Access Driver
    (*.mdb)};Dbq="
    & Server.MapPath("Database\echohockeydb.mdb") & ";"
    %>
    Joris

  • Using Password with DSNless connection to Access DB

    Has anyone actually used a password to connect to a local Access database? I keep getting the "Not a valid password" error.
    I have created an application for distribution and do not want to allow the users to change my database, so I put a password on it. Because the users can create new databases with the program, I would like to use a DSNless connection to allow the user to change the databases easily.
    I have successfully worked with the database through a DSN connection with the password, and with the DSNless connection without a password, but am unable to get in with a DSNless connection and a password.
    I have read as many postings and topics using the main key words as I can find in the APIs, forums, tutorials, bug databases, etc., but this topic is not addressed.
    I have tried as many permutations on the advice I did find, and nothing works so far. Here are a few of the tries I made:
    String theurl = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)}; DBQ=c:\\demo\demo.mdb;Password=\"demo\"";
    con = DriverManager.getConnection(theurl)
    String userid = "";
    String password = "demo" 
    String theurl = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=c:\\demo\demo.mdb;"
    con = DriverManager.getConnection(theurl,userid,password);What am I doing wrong?
    I would appreciate any help I can get.

    I'm sorry, I should have posted my entire code. As you can see, I have included the Class.forName method. The password that I set on was on the database; I did not create any users. The question about copying a database vs. creating a new one is moot here, because this database was created independently from any others. (However, you are correct in that I am actually copying a "Master" version of the database, not actually creating a totally new one.)
    Here is my code:
    import java.sql.*;
    import java.util.*;
    import sun.jdbc.odbc.*;
    public class testPassword {
      private String theurl;
      private String user = "";
      private String password = "";
      private Connection con;
      private Statement stmt;
      public testPassword() {
        try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              theurl = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};" +
                "DBQ=c:\\demo\\demo.mdb;Password=\"demo\"";
          boolean found = false;
          con = DriverManager.getConnection(theurl);
          try {
           stmt = con.createStatement();
           String pword = "";
            String query = "SELECT password FROM SysInfo";   // system Info
            ResultSet rs = stmt.executeQuery(query);
            while (rs.next()) {
              pword = rs.getString("password");
            rs.close();
            stmt.close();
            con.close();
            System.out.println("Inner Password: " + pword);
            System.exit(0);
          } catch (Exception e) {
              System.out.println("Inner failed " + e.toString());
              System.out.println("Outer Password: " + password);
        } catch (Exception ex) {
            System.out.println("Outer failed " + ex.toString());
            System.out.println("URL: " + theurl);   
      public static void main(String [] args) {
           testPassword app = new testPassword();
    }BTW, for those replies that I keep seeing all over the forum that say that you MUST create a DSN, that is NOT correct. Please do a search on "dsnless" or "dsn-less" and you will see that it is totally feasible.

  • DSNLess Connection to OracleDB v8.1.7

    Hi, I encounter problems in using DSNless approach to connect to Oracle DB. My program is using JDK1.1.8, Oracle DB version 8.1.7. Please help to identify the problem and provide solution to it.
    Below is the code used and the error message
    Trial A:
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con = DriverManager.getConnection("jdbc:oracle:thin:@IP Address:port:Oracle_SID", uid, pwd);
    Error --> java.sql.SQLException: Protocol violation
    Trial B:
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con = DriverManager.getConnection("jdbc:oracle:thin:@hostname:port:Oracle_SID", uid, pwd);
    Error --> java.sql.SQLException: hostname
    Trial C:
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con = DriverManager.getConnection("jdbc:oracle:thin:uid/pwd@hostname:port:Oracle_SID");
    Error --> java.sql.SQLException: hostname

    Hi,
    The "protocol violation' is message that is thrown when Oracle cant throw a more
    specific message.
    Please try following code, but before that please include classes12.zip in ur classpath. This file contains the oracle thin driver.
    Connection connection = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String url = "jdbc:oracle:thin:@hostname:port:Oracle_SID"
    connection = DriverManager.getConnection(url, "dbName", "password");
    }catch (Exception e){
    e.printStackTrace();
    good luck ...san :-)

  • How to connect database using type4 driver(dsn or dsnless connection)

    please send any one reply answer

    One reply - not possible.
    DSN/DSNless refers to a specific driver. And that driver is not a type 4 driver. So it is not possible.

  • DSNless connection to SQL Server and Oracle

    hi,
    how can i connect to SQl Server and Oracle without specifying the DSN.
    zulfgi

    My favorite reply again:
    Someone wrote in a newsgroup about configuring some kind of "temporary DSN".
    His example was for Excel, but it will maybe work the same way for other drivers:
    db = DriverManager.getConnection(
    "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/temp/test2.xls;DriverID=22;READONLY=false","","");
    Also someone else suggested for SQLServer:
    db = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=MyServerName;Database=MyDataBase","","");
    Find out the right driver clause for Oracle; look at the names the control panel ODBC manager shows.
    Regards,
    Hartmut

  • How to connect SQL server

    Hi
    I want to know how to connect SQL server using DNSless connection ?
    /* 2003/02/06 eric.leung
    * Source : HOME
    import java.sql.*;
    import java.lang.*;
    public class ejdbcsel {
         public static void main(String args[]) {
              // eric_jsp is ODBC User DNS
              // String url = "jdbc:odbc:eric_jsp";     
              // Using DSNless connection
              String url = "";
              url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
              ";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
              Connection con;
              String query;
              query = "select * from pt_mstr";     
              Statement stmt;
         try {     
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch (ClassNotFoundException e) {
              System.err.print("ClassNotFoundException " );
              System.err.println(e.getMessage());
         try {
              con = DriverManager.getConnection (url,"","");
              stmt = con.createStatement();
              ResultSet rec = stmt.executeQuery(query);          
              // Scan the Database
              while(rec.next()) {
                   System.out.println(rec.getString("pt_part") + "\t"
                   + rec.getString("pt_desc"));     
              stmt.close();
              con.close();
         } catch (SQLException ex) {
              System.err.println("SQLException: " + ex.getMessage());
         catch (Exception e) {
              System.err.println("Error: " + e.toString() + " " + e.getMessage());

    Use a driver...
    http://java.sun.com/products/jdbc/driverdesc.html
    http://industry.java.sun.com/products/jdbc/drivers

  • Java.sql.SQLException: Network error IOException: Connection refused:

    hi...i am tryin to connect to sqlserver2000 ....i wanted a dsnless connection...i have downloaded jtds driver...set the classpath..no joy..i'm connecting to sqlserver's default port 1433..i also confirmed that sqlserver tcp is enabled...still gettin the same err:
    java.sql.SQLException: Network error IOException: Connection refused: connect
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java
    :385)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java
    :50)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at SQLServerConnect.getConnection(SQLServerConnect.java:27)
    at SQLServerConnect.displayDbProperties(SQLServerConnect.java:44)
    at SQLServerConnect.main(SQLServerConnect.java:80)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
    at java.net.Socket.connect(Socket.java:507)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSoc
    ket.java:304)
    at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:255)
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java
    :310)
    ... 7 more
    Error Trace in getConnection() : Network error IOException: Connection refused:
    connect
    Error: No active Connection
    i even tried connecting to the port 1433 thru telnet...err:Could not open connection to the host, on port 1433:connection failed...
    i thought it cud b a firewall issue...disabled my windows firewall..no joy..
    can ne body help me with this....need to solve this desparately
    thanks in advance
    jude

    Old, but still coming up in google searches. Here's the solution that worked for me:
    Dynamic Port Allocation explained:
    http://support.microsoft.com/kb/823938
    How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)
    http://support.microsoft.com/kb/823938
    In case that dissappears:
    To assign a TCP/IP port number to the SQL Server Database Engine
    1. In SQL Server Configuration Manager, in the console pane, expand SQL Server 2005 Network Configuration, expand Protocols for <instance name>, and then double-click TCP/IP.
    2. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear, in the format IP1, IP2, up to IPAll. One of these are for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you wish to configure.
    3. If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.
    4. In the IPn Properties area box, in the TCP Port box, type the port number you wish this IP address to listen on, and then click OK.
    5. In the console pane, click SQL Server 2005 Services.
    6. In the details pane, right-click SQL Server (<instance name>) and then click restart, to stop and restart SQL Server.

  • MS db Connection String using ASP VBScript and DW8

    Hi
    My MS db has been working with DW8 followong my use of a connection string in connSci***.asp. My OS is Windows7. This has worked fine.
    <%
    ' FileName="Connection_ado_conn_string.htm"
    ' Type="ADO"
    ' DesigntimeType="ADO"
    ' HTTP="true"
    ' Catalog=""
    ' Schema=""
    Dim MM_connSciWeb_STRING
    MM_connSciWeb_STRING = "DSN=DSN_******"
    %>
    Now when I update the db and check that the new additional records have been added (and they have been) I can still only access the original records. When I retest the connection string I get the 404 error message.
    Can anyone help?
    Regards
    Kevin

    >This has worked fine.
    When did it stop working? What changes did you make?
    MM_connSciWeb_STRING = "DSN=DSN_******"
    Any particular reason you are using DSN rather than DSNless connections?
    >Now when I update the db and check that the new additional records  have
    >been added (and they have been) I can still only access the  original records.
    Can you explain? How do you know the new records where added if you can't access them?
    >When I retest the connection string I get the 404  error message.
    How are you testing the connection?

  • Connection of MS Access to Oracle

    Please help me out if anybody can help me in this i wanted to connect Oracle server from MS access application sitting on anywhere in network to migrate selected data from MSAccess to Oracle server. I am using DSNless connection using Microsoft ODBC drivers for Oracle but it is saying Oracle Client components need to be installed.Can't we connect thru this procedure without having Oracle client on same machine.

    Justin,
    thanks for your quick replies.
    Using Oracle ODBC 32Bit Test:
    the connection seems instantaneous. I tried to enable connection pooling for Oracle ODBC driver with a wait in the pool for 600s. Maybe this will keep it live and I can instantiate a fake connection every 10 minutes? I do not what else I could try ...
    Gyorgy
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Justin Cave ([email protected]):
    Can you try connecting via ODBCTest or via the 'Test Connection' button in the DSN creation dialog box, to see how long that takes? Your tnspings are certainly reasonable.
    I'm curious as to whether you see a difference between connecting via a DSN or through a DSN-less connection string.
    Justin<HR></BLOCKQUOTE>
    null

  • DSN less connection to MS-ACCESS

    Hi to everyone,
    Can anybody assisst me in connecting to MS-Access database without configuring manually in control panel.
    I want my application should confugure programatically.
    Thanks in advance.
    Regards
    khiz_eng

    Hi ,
    Thanx for your kind assisstance i have come up the exception was due to i have forgotten to include space in getConnection method.
    Is DSNless connection is going to effect performance.?
    Thanks again.
    khiz_eng

  • DB Connection Issue

    Hi, I am currently having a problem with MXDW 2004.
    I have recently got a new machine and now DreamWeaver will
    not see my DB eventhough I know that the connections are working
    and Good etc.
    I have tried using a DSN and DSNless connections and I am
    still unable to get it to see the database which is a pain as i
    cant Eddit or create recordsets or generate SQL etc.
    I know the connections are working correctly as i can view
    the site and i was able to do everything as normal on my old
    machine. Also i can still use my laptop (which is what i am now
    forced to do) But this is a pain as it's 8 years old and very slow.
    What am i doing wrong or what have i forgot to do ????????
    Any help will be greatly appreciated and I am happy to help
    anyone where ever possible

    Are you using remote I'm guessing? Have you checked both
    settings side by
    side and confirmed they are the same?
    Jon
    "PinkBioDiesel" <[email protected]> wrote in
    message
    news:e51mhu$jm2$[email protected]..
    > Hi, I am currently having a problem with MXDW 2004.
    >
    > I have recently got a new machine and now DreamWeaver
    will not see my DB
    > eventhough I know that the connections are working and
    Good etc.
    >
    > I have tried using a DSN and DSNless connections and I
    am still unable to
    > get
    > it to see the database which is a pain as i cant Eddit
    or create
    > recordsets or
    > generate SQL etc.
    >
    > I know the connections are working correctly as i can
    view the site and i
    > was
    > able to do everything as normal on my old machine. Also
    i can still use my
    > laptop (which is what i am now forced to do) But this is
    a pain as it's 8
    > years
    > old and very slow.
    >
    > What am i doing wrong or what have i forgot to do
    >
    > Any help will be greatly appreciated and I am happy to
    help anyone where
    > ever
    > possible
    >

  • Hi all java helpers ! encounter a prepareStatement problem

    hi all , i try using prepare statement and i encounter error which is
    Could not connect to database [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect .
    here are my following codes:
    <%@page contentType="text/html"%>
    <%@page import="java.sql.*"%>
    <html>
    <head>
    <title>Check Login</title>
    </head>
    <body>
    <%
    String varName=request.getParameter("userName");
    String varPass=request.getParameter("userPass");
    String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
    Connection con = null;
    String nextPage = null;
    try {
         // set up the DSNless connection to the EJewel.mdb database
         String source = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\ROOT\\access\\assess.mdb";
         // Open a Database connection with the Driver
         Class.forName(DRIVER);
         con = DriverManager.getConnection(source);
    // Create sql string to check whether userName is found in database
         //String sql = "Select * from Customers where userName='" + varName + "' and userPass='" + varPass + "'";
         // Create statement to connect to Connection
         //Statement stmt=con.createStatement();
         // Execute result set on sql string
         //ResultSet rs=stmt.executeQuery(sql);
    String sql = "SELECT * from Customers WHERE userName= ? AND userPass= ? ";
    PreparedStatement stmt = con.prepareStatement(sql);
    //stmt=con.prepareStatement(sql);
    stmt.setString(1, varName);
    stmt.execute();
    stmt.setString(2, varPass);
    stmt.execute();
    ResultSet rs = stmt.executeQuery(sql);
              if (rs.next())
              out.print("Exist");
              session.setAttribute("loginStatus", "login");
              session.setAttribute("userName", varName);
    session.setAttribute("userPass", varPass);
    nextPage="ShowMain.jsp";     
              else
              //out.print("Does not exist");
              nextPage="Showlogin.htm";
         // close the resultset and statement     
    rs.close();
    rs = null;
    stmt.close();
    stmt = null;
         } // end try
         // catch for 3 exceptions
         catch (ClassNotFoundException cnfe) {
    out.println ("Could not create driver " + cnfe.getMessage ()) ;
         catch (SQLException sqle) {
    out.println ("Could not connect to database " + sqle.getMessage ()) ;
         catch (Exception excpt) {
    out.println ("Could not connect to database, general error " + excpt.getMessage ()) ;
    } // end all catch
         // finally to close connection
    finally {
    if (con != null) {
    con.close();
    } // end finally
    %>
    </body>
    </html>
    thanks in advance

    Hi Niklaus,
    Do you have the same behavior when you try with, for instance the, Sun JVM? If so, then it is not a JRockit-specific issue and you will probably get a better answer in one of the WebLogic forums here:
    http://forums.bea.com/bea/category.jspa?categoryID=2004
    Regards -- Henrik

  • Accessing *.XLS from Java -- Help!

    Could anyone help me with some explanations about how to access MS Excel (*.elx) files from java?

    I just have Accessing Access from Java.
    /* 2003/02/06 eric.leung
    * Source : HOME
    import java.sql.*;
    import java.lang.*;
    public class ejdbcsel {
         public static void main(String args[]) {
              // eric_jsp is ODBC User DNS
              // String url = "jdbc:odbc:eric_jsp";     
              // Using DSNless connection
              String url = "";
              url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
              ";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
              Connection con;
              String query;
              query = "select * from pt_mstr";     
              Statement stmt;
         try {     
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch (ClassNotFoundException e) {
              System.err.print("ClassNotFoundException " );
              System.err.println(e.getMessage());
         try {
              con = DriverManager.getConnection (url,"","");
              stmt = con.createStatement();
              ResultSet rec = stmt.executeQuery(query);          
              // Scan the Database
              while(rec.next()) {
                   System.out.println(rec.getString("pt_part") + "\t"
                   + rec.getString("pt_desc"));     
              stmt.close();
              con.close();
         } catch (SQLException ex) {
              System.err.println("SQLException: " + ex.getMessage());
         catch (Exception e) {
              System.err.println("Error: " + e.toString() + " " + e.getMessage());

Maybe you are looking for

  • I forgot my Ipad lock passcode and haven't backed it up. Is there any way I can get it back?

    The new update of IOS asked to keep a lock passcode. And i entered one which I forgot. I had to delete my Itunes from my PC a few weeks back due to virus problems. Is there any way I could keep my data and applications and get the Ipad unlocked? I do

  • Problem with the Value property node (MacOS)

    As far as I have tested it, Value Property nodes (and Value (signaling)) don't work in MacOS : The value property appears as a boolean, the value(signaling) as a cluster (width, height). Even with boolean controls, the node is not working. No such pr

  • Is there any way to use paypal

    is there a way to buy apps thru the app store using a paypal account? i live in the country an the nearest place i can get an apple card is an hour away, i have no credit card, but i have a paypal account

  • Report3.0/6.0 - Printing in Compressmode

    Dear Friends, I am working as an Oracle-Developer/2000 Programmer in Oman. As I am new to this Software, having some problems and very much expecting your valuable suggestions/solutions from your side. Please Help me!. Problem 1: Printing Compress Mo

  • Remove nodes XML

    Hello, I have this XML "C:\entrega.xml" and I want to remove two nodes. HOW????   <?xml version="1.0" encoding="UTF-16" ?> -<BOM> --<BO> <AdmInfo> <Object>15</Object> <Version>2</Version> <Document_Lines> <row> <BaseType>17</BaseType> <BaseEntry>27</