The Artima Developer Community
Sponsored Link

Java Answers Forum
help with a error

1 reply on 1 page. Most recent reply: Dec 2, 2002 8:09 AM by Lynn Hollerman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
ben

Posts: 57
Nickname: loftty
Registered: Oct, 2002

help with a error Posted: Dec 2, 2002 6:27 AM
Reply to this message Reply
Advertisement
i have this code.
but when i put it into my visual compostion, it brings up an error what says: (The type Connection is ambiguous).
can someone tell what this means please.

String data = "jdbc:odbc:myProject";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data,"","");
PreparedStatement pstmt = conn.prepareStatement("INSERT INTO Cust VALUES (?, ?)");


Lynn Hollerman

Posts: 67
Nickname: gmholler
Registered: Mar, 2002

Re: help with a error Posted: Dec 2, 2002 8:09 AM
Reply to this message Reply
I don't know what you mean by "visual compostion", but if you mean a program like JBuilder or IDEA, that could be a message unique to it - I don't know, I can't use those tools on this machine. But it looks to me like what it's telling you is that your line "Connection conn = DriverManager.getConnection(data,"","");" isn't understood. I usually declare my connection object as a Connection (as in "public Connection conn;") after importing java.sql.* - that's imported in your code, yes? And those parameters for getConnection() - they're all valid, right?

Also, I usually have to use newInstance() with that Class.forName() call - as in "Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();"

Lynn.

Flat View: This topic has 1 reply on 1 page
Topic: having problems with sending mail---please help me Previous Topic   Next Topic Topic: graphic game does't start with ssh-connection

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use