search
HomeComputer TutorialsComputer KnowledgeWrite code using JAVA to create a table

Write code using JAVA to create a table

How to create a table using JAVA statements

Give you an example:

import java.sql.*;

import java.awt.*;public class Createexp {

public static void main(String args[]){

String url = "jdbc:odbc:wwms"; ///wwms is the data source of ODBC

Connection con = null;

Statement sm = null;try{///Load JDBC-ODBC driver bridge

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

//com.ms.jdbc.odbc.JdbcOdbcDriver /// Wrong, change com.ms to sun

} catch(Exception e){

System.out.println ("Unable to load JDBC-ODBC bridge driver"); return;}/////Establish a connection with the database and display try{con = DriverManager.getConnection(url);

sm = con.createStatement(); //Create object

//Execute the creation operation of database table

sm.execute("create table tb(tepno int, tepname char(10) )");sm.close();

java creates a linear table

import java.util.ArrayList;

import java.util.List;

public class ListDemo {

public static void main(String[] args) {

int numLength = 10;

int deleteNum = 5;

List list = new ArrayList();

init(numLength,list);

delete(deleteNum,list);

print(list);

}

private static void print(List list) {

for(int i=0;i

System.out.print(list.get(i) "\t");

}

}

private static void delete(int deleteNum,List list) {

for (int i=0;i

if((int)list.get(i)==deleteNum){

list.remove(i);

}

}

}

private static void init(int numLength,List list) {

for(int i=1;i

list.add(i);

}

}

}

//Of course it would be better if you post your code. It can help you find the problem. In addition, you can also know how much you know about Java. The help you give may be more practical.

How to add an excel table when developing software with java

HSSFWorkbook wb=new HSSFWorkbook(); //Create an Excel

HSSFSheet sheet=wb.createSheet("sheet1");//Create a Sheet

HSSFRow row=sheet.createRow(0);//Create a row

HSSFCell cell=row.createCell((short)0); //Create a cell

cell.setEncoding(HSSFCell.ENCODING_UTF_16);

cell.setCellValue("serial number"); //Set the value

cell=row.createCell((short)1);

cell.setEncoding(HSSFCell.ENCODING_UTF_16);

cell.setCellValue("surname");

The above is the detailed content of Write code using JAVA to create a table. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel办公网. If there is any infringement, please contact admin@php.cn delete
Windows 11 Education Download ISO and Install It on PC - MiniToolWindows 11 Education Download ISO and Install It on PC - MiniToolApr 26, 2025 am 12:50 AM

What is Windows 11 Education? If you want to install this system on your PC, how can you do this work? This post from php.cn gives a detailed guide on Windows 11 Education download ISO and how to install it from the ISO file.

How to Fix Outlook Emails Not Showing Up in Inbox - MiniToolHow to Fix Outlook Emails Not Showing Up in Inbox - MiniToolApr 26, 2025 am 12:49 AM

Are your Outlook emails not showing up in Inbox, but showing in search? What steps can you do when Outlook not showing all emails? Now in this post given by php.cn Solution, we will introduce several useful methods to help you address the issue and g

Must-Know Fixes: Windows Stuck on Shutting Down ScreenMust-Know Fixes: Windows Stuck on Shutting Down ScreenApr 26, 2025 am 12:48 AM

If you are trying to power off your computer but encountering the Windows stuck on shutting down screen issue, you can find several helpful fixes from this php.cn guide. Just keep reading to see the details.

[Complete Guide] How to Fix Microsoft Teams Error CAA50021? - MiniTool[Complete Guide] How to Fix Microsoft Teams Error CAA50021? - MiniToolApr 26, 2025 am 12:47 AM

If you are looking for effective solutions to the Microsoft Teams error code CAA50021, this post is worth reading. In this post, php.cn introduces how to get rid of this error in detail. Simply follow it to solve your problem.

Make Windows 11/10 Look Like Windows XP Using WindowBlinds 11 - MiniToolMake Windows 11/10 Look Like Windows XP Using WindowBlinds 11 - MiniToolApr 26, 2025 am 12:46 AM

Do you want to make Windows 11 or Windows 10 look like Windows XP? Do you know how to do this on your device? You can try the WindowBlinds 11 Beta version now. In this post, php.cn Software will tell you how to download WindowBlinds 11 and introduce

Pro Fixes: Not All of the Updates Were Successfully UninstalledPro Fixes: Not All of the Updates Were Successfully UninstalledApr 26, 2025 am 12:45 AM

If you can’t use the universal way to uninstall Windows updates due to An error has occurred, Not all of the updates were successfully uninstalled, you can try the methods mentioned in the php.cn post to solve the issue.

Fix the System Error – Wacom_tablet.exe Can't End Process - MiniToolFix the System Error – Wacom_tablet.exe Can't End Process - MiniToolApr 26, 2025 am 12:44 AM

What is wacom_tablet.exe? Is the Windows process safe to run? Some people find wacom_tablet.exe can't end process and when this Windows system error happens, you may be overwhelmed and don’t know where to start. On php.cn, this article will resolve y

3 Ways for We've Detected Suspicious Behavior on ChatGPT - MiniTool3 Ways for We've Detected Suspicious Behavior on ChatGPT - MiniToolApr 26, 2025 am 12:43 AM

ChatGPT errors are various and we’ve detected suspicious behavior is a common one. If you are trapped in this issue, what should you do? Go on reading this post from php.cn and you can find some useful fixes to help you get rid of trouble.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use