User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 429,970 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,598 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1105 | Replies: 4 | Solved
Reply
Join Date: Dec 2006
Location: in a dream
Posts: 125
Reputation: nschessnerd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
nschessnerd's Avatar
nschessnerd nschessnerd is offline Offline
Junior Poster

Help Another mysql problem

  #1  
Feb 18th, 2007
Hey, so I get a Driver error when I try to connect to my local mysql db. My code is in a servlet as follows
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            Connection con=null;
            Statement smt=null;
            con=DriverManager.getConnection("jdbc:mysql://localhost:3306/sql?user=webusr&password=pass");
Thanks
M
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,476
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 11
Solved Threads: 298
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Another mysql problem

  #2  
Feb 18th, 2007
I don't know what is the purpose if that port number over there?
I posted small part of code which I usualy use in other thread http://www.daniweb.com/techtalkforums/post316412-2.html
so you can have look and compare it with your one
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Dec 2006
Location: in a dream
Posts: 125
Reputation: nschessnerd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
nschessnerd's Avatar
nschessnerd nschessnerd is offline Offline
Junior Poster

Re: Another mysql problem

  #3  
Feb 18th, 2007
I use the port because my server is located on port 3306...
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Another mysql problem

  #4  
Feb 19th, 2007
dump the .newInstance(), it's superfluous.

Without knowing the actual error the cause of the problem will always remain guesswork.
But most likely you either don't have the correct driver or the database doesn't allow you to connect.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Join Date: Dec 2006
Location: in a dream
Posts: 125
Reputation: nschessnerd is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
nschessnerd's Avatar
nschessnerd nschessnerd is offline Offline
Junior Poster

Re: Another mysql problem

  #5  
Feb 19th, 2007
Ahh thanks, it was newInstance
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 11:50 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC