Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2004
    Posts
    9

    Unanswered: ODBC Connection from JavaScript

    Hi All,

    I'm trying to establish a connection to Pervasive SQL 7 from JavaScript, but I keep getting the following error:

    [Pervasive Software][ODBC Interface][Pervasive Software SQL Engine]General Error

    The same connection string was used from other application and it did work.

    Any clue on this? What special considerations should be taken when dealing with JavaScript?

    Thanks in advance,

    Ignacio

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    What's the connection string? Are you pointing to local or remote data? If it's remote, make sure that the lcoal machine (and the web server) has rights on the remote machine.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Dec 2004
    Posts
    9
    Well, the connection string is working properly when used from another application and it has no problem. I'm sorry, but for privacy reasons I cannot publish it here. The target tables are in network drive, and the current user is and admin with full privileges.

    The main thing here seems to be related to JavaScript because other applications can use the connection string and pull data successfully, but I'm not sure how or why js behaves like that. The message from pervasive is not very clear, besides.

    Any other clue?

    Thanks,

    Ignacio

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    If you can't post the actual connection string, then post a fake connection string that uses the same structure. FOr example are you using something like:
    DSN=DEMODATA
    or
    Driver={Pervasive ODBC Engine Interface};DBQ=DEMDOATA
    or
    Driver={Pervasive ODBC Client Interface};ServerName=Server;ServerDSN=Demodata

    While we're on the topic, does it fail to all datasources? If the exact same connection string is working from other applications on the exact same machine, then there's something that's not specifically Pervasive related and is probably permissions related.
    Since the data is remote, are you using a Named Database or a path in the connection string? If you're using a path, is it a mapped drive or UNC? Have you tried the other (if using mapped, try UNC and vice versa). In most web servers, the default user (especially IIS) does not have access to mapped drives. The currently logged in user in most cases will not have any effect on the user being used by a web server.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  5. #5
    Join Date
    Dec 2004
    Posts
    9
    At this moment I don't have the "skeleton" for the connection string, but it certainly looks like this one:

    Driver={Pervasive ODBC Client Interface};ServerName=Server;ServerDSN=Demodata

    Tomorrow I'll post the correct connection string.

    Now, I'm not using a web server. It's just a plain html page from a client machine using javascript and an ActiveX component to pull data from the tables. Using this method, it's always the same user connecting to the network share, so no permission conflicts can occur even if using the connection string from different applications. I'm using a path in the connection string with a mapped drive. I will try switching to UNC and see if that helps.

    Thanks for the help, I'll let you know how it works.

    Ignacio

  6. #6
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    When you post the correct connection string, also post the actual version of the Pervasive ODBC driver
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  7. #7
    Join Date
    Dec 2004
    Posts
    9
    Here is the kind of connection string I'm using:

    DRIVER={Pervasive Software ODBC-32};DATAPATH=h:\dat;UID=;PWD=;DDFPATH=h:\ddf;BOB=; NullEnabled=no;FeaturesUsed=no;LoginScript=;Access Friendly=no;DateFormat=;

    The driver version is the following:

    2.50.02.02

    Thanks,

    Ignacio

  8. #8
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    First, have you ever seen a client side Javascript connection to a database (any database) work? From what I'm finding, Javascript is client side only and cannot access a database. Server side javascript can access a database. How about posting your code so other's can see how your doing it?
    Also, is there any way you can upgrade? Pervasive.SQL 7 is old and unsupported. Pervasive.SQL V8 is the current version (it's actually two major versions newer). Also, if you can't upgrade, you should at least update to the latest service pack for P.SQL7. The ODBC 2.5x was not thread safe until about version 2.54.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  9. #9
    Join Date
    Dec 2004
    Posts
    9
    I should have mentioned that I'm using an ActiveX component which is declared using the <object></object> tag. After that, I use javascript to pass parameters to the declared object. Among the required parameters are the Connection String and the SQL statement or query. In this way, the component is the one that access the database, but using javascript to gather the required parameters. This is why I don't see what's causing the error when trying to load data from pervasive tables.

    I will suggest my client to at least apply the latest service pack and see if that works.

    Any other thoughts are very welcome.

    Ignacio

  10. #10
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    Can you use that ActiveX from a different environment (VB/Delphi/ASP)? Does it work there
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  11. #11
    Join Date
    Dec 2004
    Posts
    9
    This issue has been solved by recreating the connection string. I suppose the original had something wrong. On the other hand, the network OS is Netware, which is not allowing relative paths.

    There is an additional issue, but I'll open a new thread for it.

    Thanks a lot for all the help.

    Ignacio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •