Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: SQL err in WIN32

by WhiteBird (Hermit)
on Jul 30, 2004 at 20:27 UTC ( [id://378801]=note: print w/replies, xml ) Need Help??


in reply to SQL err in WIN32

I think you have everything you need to make the connection. Your syntax looks a little unusual to me, however, and I think the calls to your error routine is what might be giving you a problem. I changed your error statements to something that I'm more familiar with and was able to get past that part of the code. Try something like this for error checking:

my($DSN) = "Lake Alpine"; if (!($db = new Win32::ODBC($DSN))){ die "Error connecting: " . Win32::ODBC::Error() . "\n";

($SqlStatement) = "SELECT * FROM Mailing List"; if ( $db->Sql($SqlStatement)){ { print "error submitting SQL statment " . $db->Error(). "\n"; }

When I run the code with those statements, I get to the next part of the code which executes and it prints out "Read a record" over and over again. If you're going to actually want to read your data, you'll have some work to do on that part of the code. If you find you need help with that part, just come on back and ask more questions.

Replies are listed 'Best First'.
Re^2: SQL err in WIN32
by Robertn (Hermit) on Jul 31, 2004 at 02:30 UTC
    Hi, I did a cut and paste of your code into the program, and while it will now fall through, I still get this error. error submitting SQL statment 1 1 "-1305"
    If your getting a message rather than -1305, then I still have a problem, probably with my setup. If your getting -1305 then I don't feel so bad, but still suspect I'm missing the error file, or still not accessing it properly.

    I've not yet written the get data part, what's there is mostly from the win32::odbc fact, as I wanted to make sure I was accessing the file, before I got heavy into code, but thanks for the offer. I'll certainly come back if I get stuck. Thanks ever so much for taking your time to help out.

      I'm glad to see that EdwardG nailed the problem for you. I wasn't pulling any errors at all, but I didn't have a space in my table name. I avoid spaces in names at all costs. Just out of curiosity I renamed my table with a space in the name and I pulled up the 1305 error. In detail it reads:

      error submitting SQL statment [-1305] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'CODE'. Make sure it exists and that its name is spelled correctly."

      Which points directly to my table which is named "CODE CODE". Just FYI for future reference.

        Hi,My problem is I'm not getting any of the Microsoft message, just the numbers. If you've an opportunity, could you check the versions you have of the DB packages, aginst what I posted, I still think I may not have everything I need, or their not current. Or maybe I installed in an improper sequence. I'm getting errors now when I try to read the data using
        while ($db->FetchRow() ) { @Data= $db->Data( 1 ); }
        which should just get the first column, but I get this error sequence for every record.
        Use of uninitialized value in array element at C:/Perl/lib/Win32/ODBC.pm line 257.
        Use of uninitialized value in substitution (s///) at C:/Perl/lib/Win32/ODBC.pm line 256.
        Use of uninitialized value in substitution (s///) at C:/Perl/lib/Win32/ODBC.pm line 256.
        Use of uninitialized value in substitution (s///) at C:/Perl/lib/Win32/ODBC.pm line 256.
        Use of uninitialized value in substitution (s///) at C:/Perl/lib/Win32/ODBC.pm line 256.
        Use of uninitialized value in concatenation (.) or string at C:\Alpine\Laia_2.pl line 51.
        Line 51 being Fetchrow. Of course there maybe a problem with the data base, but everything is supposed to be stright text. Also tried using examples found at http://www.roth.net/perl/odbc/docs/ODBC_Docs.htm# for Data and Datahash, but keep getting similar errors. Of course some of those column names are names with spaces in them, so that might be yet another problem. And I thought this would be easier than figuring out visual basic. Thanks again for your time and help.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://378801]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found