Java to SQL Server Connectivity

Java to SQL Server Connectivity

Hi, heres my code

private void bookedButton() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection("jdbc:odbc:BUS","","");

        Statement stmt= conn.createStatement();
    //  stmt.execute("Set identity_insert customers on");

        String current_status="BOOKED"; 


        emp =conn.prepareStatement("INSERT INTO customers (cust_name,cust_nic,cust_contact,cust_address,seat_no,departure_date,amount,total_amount,advance,remaining_amount,booking_date,checkin_date,current_status) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,'"+ current_status+"')");

        emp.setString(1, text1.getText());
        emp.setString(2, text2.getText());
        emp.setString(3, text4.getText());
        emp.setString(4, text3.getText());
        emp.setString(5, rtext2.getText());
        emp.setString(6, ctext2.getText());
        emp.setString(7, rtext3.getText());
        emp.setString(8, rtext4.getText());
        emp.setString(9, rtext5.getText());
        emp.setString(10, rtext6.getText());
        emp.setString(11, ctext1.getText());
        emp.setString(12, ctext3.getText());

        emp.executeUpdate();

    //  JOptionPane.showMessageDialog( this, "BOOKING SUCCESSFUL!","BOOKING RESULT", JOptionPane.PLAIN_MESSAGE );
    //  dispose();

    }
    catch(Exception e)
    {
        JOptionPane.showMessageDialog( this, "BOOKING UNSUCCESSFUL!\n\nAll Fields Mandatory\n\nCheck Either Seat is Available or Not","Error", JOptionPane.ERROR_MESSAGE );
        System.out.println(e.getMessage());

    }

}

Im making a ticket reservation system with sql server connectivity at the background to save the data. Now, after entering the data in the fields, i get two "General Eroor". I don't know if i made the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you.

View Answers









Related Tutorials/Questions & Answers:
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void... with sql server connectivity at the background to save the data. Now, after... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
Advertisements
jsp sql server 2005 connectivity
jsp sql server 2005 connectivity  your jsp mysql tutorial is very help full.Please tell me how to connect jsp with SQL server 2005
DataBase connectivity in java with Microsoft sql server2000 - JDBC
DataBase connectivity in java with Microsoft sql server2000  How i can achieve database connectivity with Microsoft sql server2000 in my java source code
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying to connect to sql database via the servlet program in java.I have not been successful so far. However when i try to connect to sql through a normal java program
mysql server connectivity - Java Server Faces Questions
mysql server connectivity  hello friends, my question is that i m not able to connect jsp, servlet with sql 2000. i know we have to do some changes in administrative tools in control pannel but after click
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou.  Hi Friend, Put mysql-connector
JDBC, Java Database Connectivity
have in our site roseindia.net. Our website is very famous for JDBC and Java tutorials. Java Database Connectivity or JDBC for short is Java bases API... Connectivity or JDBC for short is a standard API in Java for accessing
sql server - SQL
sql server  what is SQL server? & what is oracle? are they same
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
SQL Server
SQL Server  Hii, What is SQL Server ?   hello,ADS_TO_REPLACE_1 SQL Server is a DBMS system provided by Microsoft
sql server - SQL
sql server  How many no of tables can be joined in same sql server
jsp page connectivity with oracle - SQL
jsp page connectivity with oracle  I am unable to database connectivity jsp with oracle. Please send the code for solving problem. thanks  Hi Friend, 1)Import the packages: 2)Load the oracle driver
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
Sql Server - SQL
sql server trigger example  Can any one tell me the live example of triggers in SQL Server?   if u click pistal trigger ,it auotmatically shoot bullet it's like newtons 3rd law (every action s having an equal reaction
Java servlet with jsp on sql server
Java servlet with jsp on sql server  How to delete a user by an admin with check box in Java Servlet with jsp on Sql Server?   Here is a jsp example that can delete the multiple record from the database by selecting
java and sql server NOT Mysql - JSP-Servlet
java and sql server NOT Mysql  Hi guys. Thank you all for the various helps you render to everyone. Please the question I asked the last time... image from MS SQL server NOT MySQL. Or is it not possible to do it in MS SQL server
java connectivity
java connectivity  i am trying to add dyanamic rows in the jsp page, when i add the new row the dropdown control value is not coming from database..please help me to overcome this problem
Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public..."); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password...("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop
Error while SQL Server connection to Java
Error while SQL Server connection to Java  import java.sql.*; public..."); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password...("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop
To retrieve image from SQL Server Database - Java Server Faces Questions
To retrieve image from SQL Server Database  Sir/Madam, I am trying to retrieve image from SQL Server 2000 database in Visual Web JSF Page using... or in Image Component. please help me in retrieving and displaying image from SQL Server
date problem in sql server - SQL
date problem in sql server  select count(*) from xxxx_tbl where emplid="+emplid+" and work_dt=#"+work_date+"#"; work_date is in string ,Backend is sql server 2000.i am getting the date problem when using in jsp page.  
XML in SQL Server
XML in SQL Server  Hi..... please anyone tell me about What is the purpose of FOR XML in SQL Server?ADS_TO_REPLACE_1 Thanks
jdbc odbc sql server exception
jdbc odbc sql server exception  Hi, I am trying to use sql server with java jdbc odbc but I am getting this exception java.sql.SQLException: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '@P1
java servlet connectivity problem with access
java servlet connectivity problem with access  Import java.sql javax.servlet //all packages entered try { Class.forName... an SQL query, get a ResultSet ResultSet rs = st.executeQuery("SELECT NAME
Merge databases in SQL SErver 2005
Merge databases in SQL SErver 2005  Please help me to merge databases in SQL server 2005
SQL SERVER 2008
SQL SERVER 2008  when i am fill the all fields in the form.but when i am retrive from the database it shows only firstname,age,address.remaining fields was shows as null.and it shows the gender as the on.i can't understand what
Sql Server like with
Sql Server like with   SELECT username FROM login WHERE CONTAINS(RelatedWords,'""Insurance"""'); How can we handle this ,throwing error like Syntax error near 'Insurance' in the full-text search condition '""Insurance
database connectivity in java - JDBC
database connectivity in java  import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; class Project implements ActionListener { JFrame f; JPanel p1,p2,p3; JTabbedPane
Java database connectivity
Java database connectivity  Hi sir I need a code to create an application where user enter name in text box and that should be stored in database. Plz help me out its very urgent.   import java.sql.*; import java.awt.
Sql Server 2008 with textbox
Sql Server 2008 with textbox  **Hi, I tried to insert into DB using textbox in a form using vb by visual studio 2010 but its always catch an error... myconn = New SqlConnection("server=localhost;" & "Initial Catalog=4
connectivity
connectivity  how to connect java with database
Data Conversion In Sql Server 2005
Data Conversion In Sql Server 2005  Hi I am working vb.net & sql server 2005 database. I am storing date (MM/DD/YYYY) format. now I have problem in sql date conversion (DD/MM/YYYY). Can you help how to convert date
Maven dependency for com.themodernway - themodernway-server-sql version 1.0.3-RELEASE is released. Learn to use themodernway-server-sql version 1.0.3-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 1.0.3-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 1.0.3-RELEASE in Java projects... - themodernway-server-sql version 1.0.3-RELEASE java library in your project. ADS
Maven dependency for com.themodernway - themodernway-server-sql version 1.2.27-RELEASE is released. Learn to use themodernway-server-sql version 1.2.27-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 1.2.27-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 1.2.27-RELEASE in Java projects...; com.themodernway - themodernway-server-sql version 1.2.27-RELEASE java library in your
Maven dependency for com.themodernway - themodernway-server-sql version 2.0.3-RELEASE is released. Learn to use themodernway-server-sql version 2.0.3-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 2.0.3-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 2.0.3-RELEASE in Java projects... - themodernway-server-sql version 2.0.3-RELEASE java library in your project. ADS
Maven dependency for com.themodernway - themodernway-server-sql version 2.1.6-RELEASE is released. Learn to use themodernway-server-sql version 2.1.6-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 2.1.6-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 2.1.6-RELEASE in Java projects... - themodernway-server-sql version 2.1.6-RELEASE java library in your project. ADS
Maven dependency for com.themodernway - themodernway-server-sql version 1.2.25-RELEASE is released. Learn to use themodernway-server-sql version 1.2.25-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 1.2.25-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 1.2.25-RELEASE in Java projects...; com.themodernway - themodernway-server-sql version 1.2.25-RELEASE java library in your
Maven dependency for com.themodernway - themodernway-server-sql version 1.2.10-RELEASE is released. Learn to use themodernway-server-sql version 1.2.10-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 1.2.10-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 1.2.10-RELEASE in Java projects...; com.themodernway - themodernway-server-sql version 1.2.10-RELEASE java library in your
Maven dependency for com.themodernway - themodernway-server-sql version 2.0.0-RC3 is released. Learn to use themodernway-server-sql version 2.0.0-RC3 in Maven based Java projects
( com.themodernway - themodernway-server-sql version 2.0.0-RC3 ) in their Java project...; com.themodernway - themodernway-server-sql version 2.0.0-RC3 in Java projects. Follow... - themodernway-server-sql version 2.0.0-RC3 java library in your project
Maven dependency for com.themodernway - themodernway-server-sql version 2.1.5-RELEASE is released. Learn to use themodernway-server-sql version 2.1.5-RELEASE in Maven based Java projects
( com.themodernway - themodernway-server-sql version 2.1.5-RELEASE ) in their Java...; com.themodernway - themodernway-server-sql version 2.1.5-RELEASE in Java... of themodernway-server-sql released The developers of  
connect sql server 2005 using php
connect sql server 2005 using php  how to connect sql server 2005 using php program. how mssql_connect will work
How to read textfile and create SQL server table ?
How to read textfile and create SQL server table ?  hi sir, your site... trying to read textfile and create table in sql server but it gives error.../questions/16415498/creating-a-table-in-sql-database-by-reading-textfile-in-java
Java and SQL - SQL
Java and SQL  i have a problem with regard to connecting my java code in getting a data to SQL. my problem is on how to come up with a pop up alert message in the user interface where in the message will be coming from the SQL
Version of com.themodernway>themodernway-server-sql dependency
List of Version of com.themodernway>themodernway-server-sql dependency
database connectivity
database connectivity  how to create database connectivity between HTML and sql server2005
create a xml from sql server 2005 - XML
create a xml from sql server 2005  hello Dear, i want to know how we create a xml file which retrieve data from Sql server 2005 using java. i am briefing my problem as follows. let i have a table in sql server 2005
ModuleNotFoundError: No module named 'django-sql-server-bcp'
ModuleNotFoundError: No module named 'django-sql-server-bcp'  Hi...: No module named 'django-sql-server-bcp' How to remove the ModuleNotFoundError: No module named 'django-sql-server-bcp' error? Thanks   Hi

Ads