Hi! How to connect Java to the MySql database? I am using Eclipse 3.1. and Mysql 5.1. Is there any Mysql driver needed to instal or is SQL driver sufficient? Plz give the link to instal Mysql driver. import java.sql.*; public class jdbc { public static void main (String[] args) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e) { System.out.println("Unable to load driver class"); } try { Connection dbcon=DriverManager.getConnection("jdbc:odbc:employee","","deepali"); Statement stmt=dbcon.createStatement(); ResultSet res=stmt.executeQuery("SELECT NAME FROM EMPLOYEE"); while(res.next()) { System.out.println(res.getString("NAME")); } res.close(); stmt.close(); dbcon.close(); } catch(SQLException se) { System.out.println("SQL Exception : "+se.getMessage()); se.printStackTrace(System.out); } } } Error: SQL Exception : [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source) at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at jdbc.main(jdbc.java:17) Plz help. Thanks in advance.
Deepali Khalkar
Posts
-
MySql database - Java connectivity -
animations on Win mobile 5.0I have some animated images and i want them to bring on Win mobile 5.0 emulator. I wanted to see the animations after deploying the application containing the animated images. I have copied the images in the picture box on smart device forms but could not see the animations on deploying. Please help. Thanks in advance
-
Viewing animations on Winmobile 5.0 emulatorI have some animated images and i want them to bring on Win mobile 5.0 emulator. I wanted to see the animations after deploying the application containing the animated images. I have copied the images in the picture box on smart device forms but could not see the animations on deploying. Please help.
-
form closingI wanted to close a previous form after calling the next form. How do i do that? I have many form in my application. When i exit the application using the following code all the forms are closed one by one. Instead i want to close the previous form after calling the next form in order to avoid the closing of all the forms after exit. Please help. DialogResult result = MessageBox.Show("Do you want to exit?", "Exit-Window", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) Application.Exit(); I have tried with the following code but the application exits automatically. The code is written on the command button on Form1. private void button1_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); frm2.Show(); this.Close(); } :)
-
Closing a formI wanted to close a previous form after calling the next form. How do i do that? I have many form in my application. When i exit the application using the following code all the forms are closed one by one. Instead i want to close the previous form after calling the next form in order to avoid the closing of all the forms after exit. Please help. DialogResult result = MessageBox.Show("Do you want to exit?", "Exit-Window", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); if (result == DialogResult.OK) Application.Exit(); I have tried with the following code but the application exits automatically. The code is written on the command button on Form1. :) private void button1_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); frm2.Show(); this.Close(); } :)
-
creating icons for windows forms under smart device application of VS2008How to create icons for windows forms under smart device application in VS 2008?
-
Creating icons for windows mobileHow to create icons in Visual studio 2008 for smart device application (Pocket PC 5 Emulator)?
-
Which .net compact frame work is uesd for WindowsCE 6.0You can use any version of .net CF If you are using earlier version of .net compact framework (i.e .net 2.0), there is no need to install it on Win mobile 6.0 as it already supports it. But if you are using .net 3.5, you need to install its cab file Win mobile 6.0. To get Win mobile 6.0 Emulator you need to install its SDK from Microsoft Download center. Hope this helps you. :)
-
Passing multiple parameters to query which counts number of rows in C#SqlCeCommand cmd = new SqlCeCommand("select count(*) from diet where uname=@uname,day=@dy,month=@mnth,year=@yr", conn); cmd.Connection = conn; SqlCeParameter para = new SqlCeParameter(); para.ParameterName = "@uname" para.Value = uname; cmd.Parameters.Add(para); SqlCeParameter para12 = new SqlCeParameter(); para12.ParameterName = "@dy" para12.Value = dy1; cmd.Parameters.Add(para12); SqlCeParameter para13 = new SqlCeParameter(); para13.ParameterName = "@mnth"; para13.Value = mnth; cmd.Parameters.Add(para13); SqlCeParameter para4 = new SqlCeParameter(); para4.ParameterName = "@yr"; para4.Value = yer1; cmd.Parameters.Add(para4); count = System.Convert.ToInt32(cmd.ExecuteScalar().ToString()); I have tried this code but getting an exception- An error parsing the query. How to pass multiple parameters to the query which counts the rows from a table? Please help. Thanks in advance.
-
Transfer of SQL server database to Windows Mobile 6.0We are getting the following error on handset File/Assembly name 'System.data.SqlServerCe,version=3.5.0.0,Culture=Neutral,Public key token=3BE235DF1C8D2AD3',or one of its dependencies was not found. Thank You :)
-
.NET CF on Windows MobileThanks a lot. I found the link very useful. I could install .net CF 3.5 on Win mobile 6.0 handset. My application involves an access to the data from SQL server mobile database in Visual studio. When i run the application on Win mobile 6.0 handset i cannot access the database but i can see the forms designed in my project. Do i need to install SQL server compact edition cab file on the handset? I went to the path C:\Program Files\Microsoft SQL server compact edition\v3.5\Devices\wce500. Here i found many folders containing cab files for SQL server compact edition. Please let me know which is the file needed to install. Also while running the application on Win mobile 5.0 emulator i used the connect the database to my project through Query Analyser 3.5. I could not see the Query Analyser 3.5 on Win moblie 6.0 handset. Please help with this. Thanks in advance. :)
-
Transfer of SQL server database to Windows Mobile 6.0I have developed an application for Win Mobile 5.0 in Visual Studio 2008. My application involves an access of data from SQL server mobile database. My application can access the data from the database when deployed on the Win mobile 5.0 pocket pc emulator. Now i have created a CAB file of my project in Visual Studio 2008 and then deployed this CAB file on Windows Mobile 6.0 (I am using HTC P3450 handset). When i run my application on the Win mobile handset i cannot access the data from sql server mobile database. What is the reason? Do i have to copy the SQL server mobile database to the Win mobile? When i deploy the application on the emulator i can see the database in Query Analyser 3.5. I then connect the database to the project through Query Analyser 3.5. I am using .Net CF 3.5 and hence i have installed its cab file on the handset. But i could not see the Query Analyser 3.5 on the handset. Please help. Thanks in advance :)
-
Passing multiple parameters to query which count number of rowsSqlCeCommand cmd = new SqlCeCommand("select count(*) from diet where uname=@uname,day=@dy,month=@mnth,year=@yr", conn); cmd.Connection = conn; SqlCeParameter para = new SqlCeParameter(); para.ParameterName = "@uname" para.Value = uname; cmd.Parameters.Add(para); SqlCeParameter para12 = new SqlCeParameter(); para12.ParameterName = "@dy" para12.Value = dy1; cmd.Parameters.Add(para12); SqlCeParameter para13 = new SqlCeParameter(); para13.ParameterName = "@mnth"; para13.Value = mnth; cmd.Parameters.Add(para13); SqlCeParameter para4 = new SqlCeParameter(); para4.ParameterName = "@yr"; para4.Value = yer1; cmd.Parameters.Add(para4); count = System.Convert.ToInt32(cmd.ExecuteScalar().ToString()); I have tried this code but getting an exception- An error parsing the query. How to pass multiple parameters to the query which counts the rows from a table? Please help. Thanks in advance. :)
-
.NET CF on Windows MobileI want to deploy an application developed in Visual Studio 2008 under smart device on Windows mobile 6. I have used .NET 3.5 while developing the application. Is there any need to install .NET Compact Framework 3.5 on Windows Mobile 6? Please provide the required URL to download the .NET CF 3.5 :)
-
command line on Win mobile 5.0 emulatorHow to view a command line on Win mobile 5.0 emulator in Visual Studio 2008. I read about upgradation of SQL server 2005 on MSDN and found that an upgrade command has to be executed on the command line of an emulator.
-
creating custom icons for Win mobile 5.0How to create custom icons for win mobile 5.0 in visual studio 2008 for smart device application.
-
command line on Win mobile 5.0 emulatorPlease let me know how to view command line on Win mobile 5.0 emulator in Visual Studio 2008? I want to upgrade SQL server compact 2.0 so that it can be used with SQL server compact 3.5. Please let me know how to upgrade.
-
database under query analyser of win mobile 5.0 emulatorI am a begineer in C#.net I have created a .sdf database in C# project of Visual Studio 2008. I have used microsoft SQL server compact 3.5 as a data source. I have set the copy to output directory property of that database as copy if newer. I have one table created under that database in VS 2008. When i run the application for the first time the database gets copied in the Query Analyser of Win mobile 5.0 emulator and i could see the table undet it. But when i add more table to the same database in C# project and then run the application once again, i could not see the newly added tables. Another problem i am facing is that the database in win mobile 5.0 emulator gets corrupted very often. What is the reason? I am losing my data due to this. I have SQL server management studio installed on my pc. I want to create a SQL server mobile database under it and then add that database to my project. Which data source i have to chose? What are the steps to be followe? What is the difference in using the database created in Query analyser and the database craeted in SQL server mobile? Thank in advance
-
Connecting C# in VS 2008 to SQL server management studioI am developing an application on Win mobile 5.0 emulator. I need SQL server 2005 for database storage and hence i am using SQL server management studio. I want to connect a smart device project in C# to SQL server 2005. I have done the following steps- 1. In SQL server management studio, i have selected server type as SQL server mobile and have entered a path for database file and then pressed connect. I have created one table under the database 2. I have connected the emulator with the active sink .I have then transfered this database to Win mobile 5.0 emulator and have placed it under Program Files in the emulator. 3. In VS 2008 under data source configuration wizard i have created a new connection.Then add connection window appears. Now i am not sure which data source to select. What will be the connection string in order to access the database on Win mobile 5.0 emulator? Please help me with this. I am a novice in application development on Win mobile platform. Please help me with the detail steps to connect the SQL mobile database to C# smart device project. Also let me if i have followed the proper steps. Thanks in advance. :)
-
Internet connection on win mobile 5.0 emulatorCan anyone tell how to access internet from Win mobile 5.0 emulator in Visual Studio 2008? My PC has internet access. Can i get the connection on the emulator? Can i surf the net through the emulator in the same way i suft through my PC? Please tell me how to do the same. Thanks in advance. :)