• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication with wampserver and netbeans 7.0.1

 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I am trying to establish connection between net beans ide and mysql client using wamp server (for mysql server facility).

As i have been executing this GUI application successfully using the following code from console but it is generating error while execute on Netbeans ide.


it is giving following error msg.

com.mysql.jdbc.Driver

I have register my mysql server to database service. and it is listing server path in the Services window.

Please suggest what more improvement i can make in this code to establish a connection between Netbeans ide and MySQL database client via Wamp server as mysql server.

Thank you!
err_nb.PNG
[Thumbnail for err_nb.PNG]
Snapshot of Listing of database URL
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this may be the issue with the path.

can you check where the jar file has been included..

you need to include the jar file in your project also using java build path.

please check.
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, it is net beans in built jar file. may i know why do i need to pay attention to this in-built path.

thanks
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case if it is not an in-built one, you need to pay attention to make sure the path
is available to the project.

The jar file should be placed in Apache Tomcat/lib folder, in case you are this server.
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in case you are using the tomcat..
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D:\Program Files\NetBeans 7.0.1\ide\modules\ext\mysql-connector-java-5.1.20-bin.jar

i have updated this .jar and still not able to execute the application. i have been facing same error..

thanks
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i m working on desktop application. and i m using 'wampserver' to provide mysql server facility and i have no idea how to give the path to my project. Please throw some light on this issue as well.

thanks
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
since its a desktop application and the jar files are in-built.. it should work.

make sure...
1.the wamp server is running.
2. NetBeans - window - services - databases - Drivers - MySql connector is available.
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch Nikhil, hope you get plenty of help (but I can't offer any)
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wendy Gibbons wrote:Welcome to the ranch Nikhil, hope you get plenty of help (but I can't offer any)


thank you sir/ma'am!
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sailaja koney wrote:since its a desktop application and the jar files are in-built.. it should work.

make sure..
1.the wamp server is running.
2. NetBeans - window - services - databases - Drivers - MySql connector is available.


actually sir/ma'am, all these things/softwares are running properly. But still I m not able to establish an connection with mysql server. I have copied latest .jar file for MySQL JDBC Connector /J at the exact location.

However i would like to introduce you one more figure that will show something. Please pay attention to graphic put before driver string at left hand side.

It says (as i have guessed) that it had properly connected with server but unable to establish any connection, while same code is working good without netbeans IDE.

I think there is some mistake in the way I am trying to achieve this goal. Please make me correct if I m really going down to wrong way.

Thanks!!
err_nb1.PNG
[Thumbnail for err_nb1.PNG]
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String URL = "jdbc:mysql://localhost:3306/test";
String db ="test";

probably, you are mentioning the database name twice....
can be like this..
String URL = "jdbc:mysql://localhost:3306/";
String db ="test";

or
String URL = "jdbc:mysql://localhost:3306/test";

try this
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have inspected very closely the properties of Database connection created by ide. at one place in the property of this connection i found the driver name as MySQL-AB JDBC Driver, while it is listed as MySQL (Connector/ J driver) just above this connection name.

is there any problem by the different name of ab-jdbc driver name.?

Thank you!
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sailaja koney wrote:
...

probably, you are mentioning the database name twice....
can be like this..
String URL = "jdbc:mysql://localhost:3306/";
String db ="test";

...


oh i m sorry, i was not aware about this big mistake, however, i have made these changes.. and still i m not able to get connection object initialised with Connection. < i just have debugged using break point >

update:

I have uploaded one more image, and i am not aware about this whether it is important to fill these values or not. if yes then, what values can be fill here.

UPDATE @1827 hrs

i have supplied these values in mysql admin tool window. (all values are from adcending order)

path/url to admin tool: %root%:\wamp\bin\mysql\mysql5.5.16\bin\mysqladmin.exe
no argument

path to start command:
%root%\wamp\bin\mysql\mysql5.5.16\bin\mysqld.exe
without argument

path to stop command:
%root%\wamp\bin\mysql\mysql5.5.16\bin\mysqladmin.exe
argument: -u root stop

UPDATE 1910 hrs

i made above changes with the help of this link Connecting to a MySQL Database - NetBeans IDE Tutorial
thank you!!
err_nb4.PNG
[Thumbnail for err_nb4.PNG]
is it important fill administrator path.
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please show what is the exact error in the error console...


try copy and placing the jar file here ..
C:\Program Files (x86)\Java\jre6\lib\ext\

and add the same path to the project through build path in NetBeans
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

if you don't mind i would like to know how to add this build path in net beans ide.


i have wrote all these code in try /catch block, so i don't get much error except the name of driver that is com.mysql.jdbc.Driver.

UPDATE: Do you meant to change "Ant Home Path". Is it what that compile our java source code.??

thank you!
 
sailaja koney
Greenhorn
Posts: 13
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
place the jar file here..
C:\Program Files (x86)\Java\jre6\lib\ext\

and open net Beans
right click on your project-go to properties-libraries-there you will find the Add Jar/Folder.

add the above mentioned file there.
 
Nikhil B. Singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sailaja koney wrote:place the jar file here..
C:\Program Files (x86)\Java\jre6\lib\ext\

and open net Beans
right click on your project-go to properties-libraries-there you will find the Add Jar/Folder.

add the above mentioned file there.


Thank you so much Sailaja Koney ji..!!

Finally, with your constant help I have get compiled successfully this connectivity issue in net-beans too.

Thank you soo much for joining this thread.


err_nb_resolved.PNG
[Thumbnail for err_nb_resolved.PNG]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic