Question: Error while SQL Server connection to Java



Share on Google+Share on Google+

Deepika Thota
Error while SQL Server connection to Java
0 Answer(s)      4 years and 8 months ago
Posted in : SQL

import java.sql.*; public class OdbcSqlServerConnection { public static void main(String args[]) throws Exeption { Connection con=null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER;user=DTHOTA;password= "); System.out.println("First Connection ok."); con.close(); prop = new; prop.put("user", "DTHOTA"); prop.put("password", " "); con=DriverManager.getConnection("jdbc:odbc:SQL_SERVER", prop); System.out.println("Second Connection ok."); con.close(); } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } }


After writing this code, i am getting an error as class,interface or enum is expected How to fix it.

View Answers

Related Tutorials/Questions & Answers:
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
SQL connection error in android
SQL connection error in android  hi, i am android developer . recently i made one application connect with sql server 2005 using jtds...:sql:Exception : BUFFERDIR connection property invalid. if you have any answer
Database connection sql server 2005 - JDBC
Database connection sql server 2005  Hi all i am developing an application in struts and i need to connect database for that application using sql server 2005.. can anyone tell me how to make database connection ..plz help me
error while compiling - Java Beginners
error while compiling  i am facing problem with compiling and running a simple java program, can any one help me, the error i am getting is javac is not recognised as internal or external command  Check if you JAVA_HOME
Error While Compiling - Java Beginners
Error While Compiling  Hi All I Am a beginner and i face the following problem while compiling can anyone help me. C:\javatutorial\example> javac 'javac' is not recognized as an internal or external
java oracle connection problem - SQL
java oracle connection problem  I have successfully made connection with the oracle10g database that i am using and also able to put in data using JSP. But the codes that i have tried for fetching the data are not working even
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...("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection
error of HTTP Status 404 while running servlet on apache tomcat server
error of HTTP Status 404 while running servlet on apache tomcat server ... the apache tomcat page. It mean that my tomcat server is up and running. but whn i... here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could
JDBC Connection code to connect servlet with SQL Server 2008
JDBC Connection code to connect servlet with SQL Server 2008  Please... sqljdbc4.jar but the output is SEVERE: Java Runtime Environment (JRE) version 1.6... connection code is static Connection con; static Statement st; static
Java Compilation error - SQL
Java Compilation error  ava.lang.NullPointerException at beanUtils.SaleHeaderUtility.getFullRemainPatientList( at forms.ProcessDialog.updatePatientBalances(
errors while run - Java Server Faces Questions
errors while run  I,ve download the SimpleHelloByEnteringName jsf intoduntion sample project and tried to run this application following the steps narrated in roseindia jsf tutorial. But i found the fillowing error:(My
connection error - WebSevices
connection error   while conncting a tool(jet profiler for my sql 1.0 released) with my running application ,it reflects following error: connected,but failed to login,read time out
connection - SQL
connection  how can i establish connection between netbean_ide6.9 with mysql or oracle  Hi Friend, Please visit the following link: Hope that it will be helpful
PHP SQL close connection
,$connection) or exit("Sql Error".mysql_error()); echo "... PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP
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...;/tr> <%try{ Connection conn = null; Class.forName("com.mysql.jdbc.Driver
error while running the applet - Java Beginners
error while running the applet  import java.applet.Applet; import java.awt.*; import java.awt.event.*; class MyFrame extends Frame { boolean...); ++num; } } } } i have problem while running the code , error
connection proxy error in hibernate
connection proxy error in hibernate  while we get connection through hibernate we arise an error connection proxy error while we are using multiple connection's
DataBase connection with sql - Struts
DataBase connection with sql  How to connect sql and send db error in struts? what are the tag should i code in struts-confic.xml
database connection - SQL
to connect sql server to my eclipse editer how to connect and where i have to write code... the tables. Thanks in advance.  Hi Friend, Do you want to use java-database connection in eclipse IDE? Thanks
ftp connection error php
ftp connection error php  Getting a ftp connection error in php
Sql Connection is not creating
Sql Connection is not creating  Hi i am developing an web application... type 1 driver.And when i am running through eclipse using apache tomcat server it is creating sql connection and allwoing me to access excel but when i am
SQL Server
SQL Server  Hii, What is SQL Server ?   hello, SQL Server is a DBMS system provided by Microsoft
Java error reached end of file while parsing
Java error reached end of file while parsing       Java Error reached end... an error i.e java error reached end of file while parsing as the class closing braces
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
Error - Java Server Faces Questions
""; } But In eclipse i am getting Error Like This, import org.apache.log4j.Logger cannot... Is the Error. Thanks. Puppy   Hi friend, Very simple problem
sql server - SQL
sql server  what is SQL server? & what is oracle? are they same
Server DB connection - JDBC
Server DB connection  Hello Guys I want to connect two databases at the same time but it looks like the java is only picking up the second database. One database is on my localhost and the other one is on server, I want
sql express connection
sql express connection  Sir, I am using ms-SQL server 2005 as database. i have .mdf file and .ldf database base files with me. How to connect to these files in my web application. I am using type-4 drivers... Please let me know
sql server - SQL
sql server  How many no of tables can be joined in same sql server
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying... successful so far. However when i try to connect to sql through a normal java program... to store data into sql database the connection does not get established. I am
Java Spring Hibernate Struts Training How to Fetch Data using dropdown option How to get day from date in SQL? Example of sorting results in MySQL Distinct and Limit example in MySQL How to download install and use MySQL workbench? Example of Average, Sum, Min and Max functions in MySQL How to delete data from MySQL? Update SQL Query Example Order by example in MySQL AND and OR Operators in MySQL Query Where clause with query in MySQL How to use select Statement in MySQL? How to insert data into MySQL Table? Create Database and tables in MySQL example of before insert trigger in mysql Failed to Call Procedure MY Sql Query Error - Not able to Understand the issue which query will be run for previous(button) question How to access data yearly from DB in C# ? Fastest way to upload huge raw data in database - c#, Java or stored procedure DB Insert Nb hours between 2 time stamps meets specific criteria mysql select into table from another table example MySQLselect into new table Example code How to create a .mdf file from script (.sql) Please help me out fixing broken relational links in MySQL database after an upgrade How do I upgrade mysql? mysql 4.x to 5.x upgrade problem Upgrading a PHP/MYSQL application? upgrading sql query join phpmyadmin in whm whm php version update php cpanel cpanel mysql downgrade cpanel mysql version upgrade mysql whm upgrade mysql 4 5 cpanel upgrade mysql cpanel server Did my upgrade from mySQL 5.1 to 5.5 work Upgrade to MySQL 5.5 ? - cPanel Mem use upgrade from MySQL 5.1 to 5.5 - cPanel Upgrading MySQL from 5.0 to 5.1 or 5.5 - cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5)cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5) - cPanel Updating from MySQL 5.0 to 5.5 cPanel MySQL 5.1 upgrade to 5.5 error Charset problem upon publishing PHP + MySQL website MySQL issue: Table 'data_dictionary.CHARACTER_SETS' doesn't exist SQL Error Version 5.5.15


Advertisement null